Jump to content

Lisp to stretch/move points on feature lines


broncos15

Recommended Posts

So I was able to create a lisp routine to allow the user to move a feature line without changing the elevation of feature line by messing with the osnapz value. Unfortunately I am having issues with creating a lisp routine for when the user selects a feature line and then wants to drag a PI to another place. The way I am trying to make it so that the user can type in command at the command line that changes their settings. Then, they would grab the feature line and be able to drag it wherever they wanted. After that, they would type another command that would reset their settings. I have tried messing with the osnapz, but that only applies for things outside the stretch command unfortunately. I know that I can change the point filters to only .xy, but this still requires the user to enter in the elevation. Does anyone have any other ideas of how I could achieve this?

Link to comment
Share on other sites

I ended up just making a lisp to toggles the osnapz. What is interesting is that having osnapz off works only part of the time for moving the feature lines by stretching. Does anyone know why this doesn't always work?

Edited by broncos15
Link to comment
Share on other sites

So I have realized that turning osnapz off only works about half the time when grabbing a feature line and dragging the PI to another location but keeping the current elevation of the PI. My solution was to create the following code:

(defun c:zo (/ oldecho)
 (setq oldecho (getvar "cmdecho"))
 (setvar "cmdecho" 1)
 (command ".xy" pause "@")
 (setvar "cmdecho" oldecho)
 (princ)
)

The user would then hit 'zo after grabbing the feature line and when they are trying to move a PI. Unfortunately, it doesn't seem to work correctly because it still wants a z value. Does anyone know why this wouldn't work correctly?

Link to comment
Share on other sites

So I found a code online that I have been trying to use within the grip edits, but it doesn't move it correctly. The code is:

(DEFUN C:RXY (/ PT1 PT1x PT1y PT2 PT2x PT2y TRANXY)
 (PRINT)
 (SETQ PT1 (GETPOINT "First reference point xy: "))
 (PRINT)
 (SETQ PT2 (GETPOINT "Second reference point xy: "))
 (setq PT1x (CAR PT1)
PT1y (CADR PT1)
PT2x (CAR PT2)
PT2y (CADR PT2)
 )
 (SETQ TRANXY (LIST (- PT2x PT1x) (- PT2y PT1y) 0.0))
 (SETQ TRANXY (trans TRANXY 0 0))
)

Link to comment
Share on other sites

  • 7 years later...

Broncos15, did you figure out a solution to this? I have been wanting something like this for years. I do know you can use the .xy transparent command then type the "@" symbol and the elevation will stay the same. It would be nice if I could start a lisp and drag PI's all over and it keep the same z elevations at every command.

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