hosyn Posted June 13, 2020 Posted June 13, 2020 (edited) Hello guys i m looking for a lisp code over the web for moving block perpendicularly on pline and found following: (defun c:sto ( / en obj pts_ss ss_len c pten ptobj pted pt pt2) (setq en (ssget "_X" (list (cons 0 "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,POLYLINE,SPLINE") (cons 8 "A-WALL-INTR") )) ) (princ "\nSelect Blocks: ") (setq pts_ss (ssget (list (cons 0 "INSERT")))) (setq ss_len (sslength pts_ss)) (setq c 0) (while (< c ss_len) (setq pten (ssname pts_ss c)) (setq ptobj (vlax-ename->vla-object pten)) (setq pted (entget pten)) (setq pt (cdr (assoc 10 pted))) (setq cnt 0) (while (< cnt (sslength en)) (setq ename (ssname en cnt)) (setq pt2 (vlax-curve-getClosestPointTo ename pt)) (setq cnt (+ cnt 1)) ) (vla-move ptobj (vlax-3d-point pt) (vlax-3d-point pt2)) (setq c (+ c 1)) ) (princ) ) unfortunately have slight error, please correct it anyone who can,we appreciate in advance gentleman. here this is error: STO Select Blocks: Select objects: Specify opposite corner: 1 found Select objects: Specify opposite corner: 0 found, 1 total Select objects: 1 found, 2 total Select objects: Specify opposite corner: 0 found, 2 total Select objects: error: bad argument type: lselsetp nil Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. Command: Command: Edited June 14, 2020 by hosyn Quote
dlanorh Posted June 14, 2020 Posted June 14, 2020 This lisp has been "found" before. See Here 1 Quote
hosyn Posted June 14, 2020 Author Posted June 14, 2020 (edited) AT THERE AFTER RUNNING COMMAND STILL THERE SOME ERROR INSTEAD CORRECT JOB. Edited June 14, 2020 by hosyn Quote
hosyn Posted June 14, 2020 Author Posted June 14, 2020 2 hours ago, dlanorh said: This lisp has been "found" before. See Here AT THERE AFTER RUNNING COMMAND STILL THERE SOME ERROR INSTEAD CORRECT JOB. Quote
pBe Posted June 14, 2020 Posted June 14, 2020 (edited) en variable is emtpy , and user still went ahead and select the block, that is why (sslength en) will produce that error You can remove "X" to enable the user to select on sceen Make sure the selection is under the same layer listed as the filter (setq en (ssget "X" ;<-- this for selection mode (list (cons 0 "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,POLYLINE,SPLINE") (cons 8 "A-WALL-INTR") ; <--- that layer name )) ) BTW: the lisp code is not that exciting at all Edited June 14, 2020 by pBe 1 Quote
hosyn Posted June 14, 2020 Author Posted June 14, 2020 (edited) this my fult in typing, i wanted to text EXISTING CODE and auto-correct changed it. Edited June 14, 2020 by hosyn Quote
hosyn Posted June 14, 2020 Author Posted June 14, 2020 (edited) 31 minutes ago, pBe said: en variable is emtpy , and user still went ahead and select the block, that is why (sslength en) will produce that error You can remove "X" to enable the user to select on sceen Make sure the selection is under the same layer listed as the filter (setq en (ssget "X" ;<-- this for selection mode (list (cons 0 "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,POLYLINE,SPLINE") (cons 8 "A-WALL-INTR") ; <--- that layer name )) ) BTW: the lisp code is not that exciting at all If I want changed it for closest existing pline someting like that: (setq en (ssget "X" ;<-- this for selection mode (list (cons 0 "POLYLINE") ;;;; <<<-----the nearest pline to any block (cons 8 "A-WALL-INTR") ; <--- that layer name )) ) <<<-----the nearest pline to any block HOW IT BE CHANGED? Edited June 14, 2020 by hosyn Quote
pBe Posted June 14, 2020 Posted June 14, 2020 (edited) 43 minutes ago, hosyn said: If I want changed it for closest existing pline someting like that: (setq en (ssget "X" ;<-- this for selection mode (list (cons 0 "POLYLINE") ;;;; <<<-----the nearest pline to any block (cons 8 "A-WALL-INTR") ; <--- that layer name )) ) First of all, the "X" at ssget filter will select absolutely all "POLYLINE" on the drawing, and i mean ALL , I take it most it not all blocks are slightly off and you want an easy way to do it. and next you will be needing to align the blocks, etc.. I would suggest to go back to where the original code was "found" and post you're request there. EDIT: I see that this requst is related to this, why not continue that thread instead of craeting a new one Hosyn? Edited June 14, 2020 by pBe 1 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.