Entmod to trim two lines
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Entmod to trim two lines

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
JFields
Guest





Posted: Tue Dec 28, 2004 10:31 pm    Post subject: Entmod to trim two lines Reply with quote

I am trying to write a routine to make duct transitions and I want it to trim the two lines of the original duct using entmod. What I have so far works only for lines drawing horizontal and vertical but not in between. If I run the routine on ducts drawn at any other angle it doesn't trim from the correct points. Here is part of the program:

(setq p1 (getpoint "\nPick left side of duct: "))
(setvar "OSMODE" 128) ;PERP
(setq p2 (getpoint p1 "\nPick right side of duct (PERP): "))
(setvar "OSMODE" 0) ;NONE
(setq dist1 (distance p1 p2))
(setq ent1 (ssname (ssget p1) 0)
ent2 (ssname (ssget p2) 0))
(setq duct1 (entget ent1)
duct2 (entget ent2))
(setq objlayer (cdr (assoc 8 (entget ent1))))
(command "layer" "s" objlayer "")
(setq defang 15.0)
(setq ang1 (getreal (strcat "\nEnter LEFT taper angle (" (rtos defang 2) "): ")))
(if (null ang1) (setq ang1 defang))
(setq ang2 (getreal (strcat "\nEnter RIGHT taper angle (" (rtos defang 2) "): ")))
(if (null ang2) (setq ang2 defang))
(command "line" p1 p2 "")
(setq orient (- (angle p2 p1) (/ pi 2)))
(setq pt1 (cdr (assoc 10 duct1))
pt2 (cdr (assoc 11 duct1))
pt3 (cdr (assoc 10 duct2))
pt4 (cdr (assoc 11 duct2))
)
(if (= (angle p1 pt1) orient)
(entmod (subst (cons 10 p1) (cons 10 pt1) duct1))
(entmod (subst (cons 11 p1) (cons 11 pt2) duct1))
)

(if (= (angle p2 pt3) orient)
(entmod (subst (cons 10 p2) (cons 10 pt3) duct2))
(entmod (subst (cons 11 p2) (cons 11 pt4) duct2))
)

I think the problem is my choice of using an if to find the point of the line that is in the direction of the desired transition. The last two if statements are where I need help. Any suggestions or ideas on what I could do to fix this problem would be greatly appreciated.

Thanks,
Joe Fields

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB