maahee Posted Wednesday at 11:43 AM Posted Wednesday at 11:43 AM (defun c:bm () (setq s1 (getpoint "\nEnter first insertion point: ")) (setq sset1 (ssadd)) ; create blank / empty selection set (repeat 6 (setq r1 (polar s1 (* pi 0.5) 0.15)) (setq t1 (polar r1 0 0.3)) (command "pline" s1 r1 t1 "") (ssadd (entlast) sset1) (setq s1 t1) ) ; Join all polylines in the selection set (command "_.join" sset1 "") ) enable to join polyline Quote
Steven P Posted Wednesday at 01:08 PM Posted Wednesday at 01:08 PM (edited) Quick testing, join wants individual entities and not a selection set: use (ssname sset1 0) (ssname sset1 1)... instead of sset1 Alternative would be record all the points in a list and entmake the polyline using these points or (command pline.... ) with all the points for all the stair EDIT: Following your code, this uses the entmake method: (defun c:test ( / s1 points r1 t1 newpoly) (setq t1 (getpoint "\nEnter first insertion point: ")) ; Get insertion point (setq points (list t1)) ; Create a list of points (repeat 6 ; repeat n times (6) (setq r1 (polar t1 (* pi 0.5) 0.15)) ; riser calculation (setq t1 (polar r1 0 0.3)) ; tread calculation (setq points (append points (list r1))) ; add riser point to list of points (setq points (append points (list t1))) ; add tread point to list of points ) (setq newpoly (entmakex (append (list ; create a polyline from list of points (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length points)) (cons 70 0)) (mapcar (function (lambda (p) (cons 10 p))) points)) )) ; end setq, end entmakex (princ) ; exit quietly ) Edited Wednesday at 02:15 PM by Steven P 1 1 Quote
mhupp Posted Thursday at 03:17 AM Posted Thursday at 03:17 AM (edited) Join worked with selection sets or it did in BricsCAD, but They have to be touching. 15 hours ago, Steven P said: join wants individual entities and not a selection set: use (ssname sset1 0) (ssname sset1 1)... instead of sset1 quick googling you have to use the first entity in the selection set to "continue the command" then call the selection set. (command "_.join" (ssname sset1 0) "_J" sset1 "_Y") Use entmake way instead its much cleaner. -Edit Might want to make the rise and tread dynamic (defun C:FOO (/ SPT EPT RPT TPT ptlst) (setq SPT (getpoint "\nEnter Start Point: ") EPT (getpoint "\nEnter Top of First Stair: ") RoR (mapcar '- SPT EPT) ;Rise over Run from SPT to EPT R1 (polar SPT 0 (cadr RoR))) ptlst (append ptlst (list SPT R1)) ) (repeat 6 (setq RPT (polar r1 (* pi 0.5) (car RoR))) (setq TPT (polar r1 0 (cadr RoR))) (setq ptlst (append ptlst (list RPT TPT))) (setq RPT TPT) ) Edited Thursday at 04:33 AM by mhupp 1 1 Quote
Steven P Posted Thursday at 08:58 AM Posted Thursday at 08:58 AM Thanks Mhupp - thought there was a smarter way with the join command Quote
BIGAL Posted Thursday at 10:01 PM Posted Thursday at 10:01 PM (edited) If your drawing stairs then why not use a Stair LIsp. There are plenty of examples out there just do a google, look for floor start pick point, end point floor above point. A lot of them have the rules of stair design built in. For me "The AS1657 standard provides dimensional “deemed to comply” requirements", there should be a standard for where you are in the world. Even here in Cadtutor look for "looking-for-lisp-draw-simple-stairs" you need to look for answers yourself. Edited Thursday at 10:03 PM by BIGAL Quote
Recommended Posts
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.