Jump to content

trim in loop function


maahee

Recommended Posts

Posted (edited)
(defun c:maahee ()

(setq p1 (getpoint "\nEnter start point: "))
(setq p2 (getpoint p1 "\nSelect second point: "))
(setq dist (getint "\nEnter number: "))
(setq inc (/ (distance p1 p2) dist))

(setq i 0)
(while (<= i dist)

(setq stpt-b (polar p1 (angle p1 p2) (* i inc))) 
(setq stpt-f (polar p1 (angle p1 p2) (+ (* i inc) 0.5))) 

(setq vertpt-b (polar stpt-b (+ (/ pi 2) (angle p1 p2)) 2.00))
(setq vertpt-f (polar stpt-f (+ (/ pi 2) (angle p1 p2)) 2.00))

(setq ssdl1 (ssadd)) ; create blank / empty selection set
(command "line" stpt-b vertpt-b"") ;; Draw the connect point
(ssadd (entlast) ssdl1)

(setq ssdl (ssadd)) ; create blank / empty selection set
(command "line"  stpt-f vertpt-f"") ;; Draw the connect point
(ssadd (entlast) ssdl)

(setq ss1 (ssadd)) ; create blank / empty selection set
(command "line"p1 p2"")
(ssadd (entlast) ss1)

(command "_.offset"  2 ss1 vertpt-f"")

(setq c1 (polar stpt-b (angle p1 p2) 0.25))
(setq c2 (polar vertpt-b (angle p1 p2) 0.25))


(command _trim"" ssdl1 ssdl"" "f" c1 c2"")

(setq i (+ i 1))
)

)

Trim function not work in loop   (command _trim"" ssdl1 ssdl"" "f" c1 c2"") please help for solve issuepre widget

Edited by maahee
Link to comment
Share on other sites

Posted (edited)

Check all your command line's need to have space between variables and "quotes"

;bad (command _trim"" ssdl1 ssdl"" "f" c1 c2"")
;good (command _trim "" ssdl1 ssdl "" "f" c1 c2 "")
                   space        space        space

 

I counted about 5 lines that need space

 

--edit

Its also a good idea to add "_non" when feeding points into command line because they do snap to entity's that are close depending on zoom level. even if osnap is toggled off.

(command "line" "_non" p1 "_non" p2 "")

 

--edit -- edit

just looked at the code a bit more and move all the creating of the blank selection sets outside of the loop you only need to do that once. and it might clear out the selection set.

Edited by mhupp
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • maahee changed the title to trim in loop function
Posted (edited)
(command "pline"  vertpt-b stpt-b stpt-f vertpt-f "c")

 

Trim all object present inside the all pline trim at one time which is created by while loop function it is more effective than trim single object process 

Edited by maahee
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...