Results 1 to 6 of 6

Thread: Lisp to move block along line

  1. #1
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Lisp to move block along line

    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-

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Lisp to move block along line

    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 .

  3. #3
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Lisp to move block along line

    Stretch works but I'm looking for a way to only select the block and be able to scoot it around.

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Lisp to move block along line

    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 .

  5. #5
    Member
    Join Date
    2011-08
    Posts
    30
    Login to Give a bone
    0

    Default Re: Lisp to move block along line

    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)
    )


  6. #6
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Lisp to move block along line

    Seems to be closer to what I'm needing but still having problems getting it to run correctly.

Similar Threads

  1. Offset text line/Best fit/Move Text No Leader (Dynamic Block)
    By mbrandt5 in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2015-04-02, 07:27 PM
  2. Change dynamic block visibility with command line or lisp
    By gjp in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2009-06-11, 07:23 PM
  3. LISP trim/break line inserting block
    By aldiyars1925 in forum AutoLISP
    Replies: 1
    Last Post: 2008-09-09, 01:33 PM
  4. Move 3D LISP
    By tollyboy22 in forum AutoLISP
    Replies: 6
    Last Post: 2006-04-13, 05:59 PM
  5. Move Lisp
    By lmitsou in forum AutoLISP
    Replies: 2
    Last Post: 2006-02-24, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •