Is it possible to write a lisp routine that will allow you to move a schematic symbol that is on a line and keep the line attached on both ends? Similar to the scoot command in AutoCAD electrical.
EX:
---p--- to -p---- or -----p-
|
Is it possible to write a lisp routine that will allow you to move a schematic symbol that is on a line and keep the line attached on both ends? Similar to the scoot command in AutoCAD electrical.
EX:
---p--- to -p---- or -----p-
I guess the STRETCH command could help in this regard but keep in mind that the stretch command needs to select objects by window selection set with one shut otherwise the result won't be as expected .
Stretch works but I'm looking for a way to only select the block and be able to scoot it around.
I am not using Autocad Electrical so I don't know the scoot command in that version , so can you bring a snapshot or a sample drawing showing your aim of the routine ?
Did you try to wipeout the background of the block and after that you won't be in need of the two end points of lines , but you need complete lines .
I have no Autocad electrical, but this routine can move a block along a Polyline. My problem only is, how I can stop grread if I would stop moving. Now it stops only with push esc.
(defun c:foo ( / myerror pline block z pt)
(setq oldError *error*)
(defun myError (msg)
(setvar "OSMODE" osm)
(princ (strcat "\nCancel: " msg))
(setq *error* oldError)
)
(setq osm (getvar "OSMODE"))
(setvar "OSMODE" 0)
(setq *error* MyError)
(setq z 0)
(while (not (and (<= z 0)
(setq obj (entsel "\n Select a Polyline"))
(= "LWPOLYLINE" (cdr (assoc 0 (entget (setq pline (car obj))))))
(while (not (and (>= z 0)
(setq obj (entsel "\n Select a Block"))
(if (= "INSERT" (cdr (assoc 0 (entget (setq block (car obj))))))
(setq z 1)
)
)
)
z
)
)
)
(setq pt (cadr (grread t 13)))
(while
(= 5 (car (setq pt (grread t 13 0))))
(redraw)
(setq pt (cadr pt)
cp (vlax-curve-getclosestpointto pline pt)
)
(grdraw pt cp 1 1)
(entmod (subst (cons 10 (mapcar '+ cp (list 0 0))) (assoc 10 (entget block)) (entget block)))
)
(redraw)
)
(setq *error* oldError )
(setvar "OSMODE" osm)
(princ)
)
Seems to be closer to what I'm needing but still having problems getting it to run correctly.