Jump to content

Recommended Posts

Posted (edited)

I am not sure why i cannot get the routine to rotate. It just moves it only.

 

(defun C:RNMA ( / ss1) ;;Move and Rotate Selected objects from Hardcode Basepoint and Hardcoded Reference Angel)
  (setq ss1 (ssget))
  (command "_.move" ss1 "" "3578852.9644,2380600.5550" "567665.2337,2373470.1987")
  ;;(command "_.rotate" ss1 "" "567665.2337,2373470.1987" "_reference" "181.65665326" "180.71322747")
  (command "_.rotate" ss1 "" "567665.2337,2373470.1987" "359.05657421")
(princ)
)

 

Edited by rcb007
  • rcb007 changed the title to Cannot get ssget to rotate to an angle
Posted (edited)

Need another set of empty "" to set the angle (enter key) Like after the SS1 the "" is saying im done with the selecting

 

(defun C:RNMA (/ ss1)  ;;Move and Rotate Selected objects from Hardcode Basepoint and Hardcoded Reference Angel)
  (if (setq ss1 (ssget)) ;if anything is selected
    (progn  ;do this
      (command "_.move" ss1 "" "_non" "3578852.9644,2380600.5550" "_non" "567665.2337,2373470.1987")
      (command "_.rotate" ss1 "" "_non" "567665.2337,2373470.1987" "359.05657421" "")
    )
    (prompt "Nothing Selected")
  )
  (princ)
)

 

Think of it as everything in quotes is what you type. so you typed the 359 angle but then didn't hit enter. the "" simulates the enter key or picking the default option in other cases. To figure that out I try to type out the command manually one time. where ever I have to hit enter or want the default option I put ""

 

Also use "_non" when using points depending how far you are zoomed out it could snap to something close.

 

its also good to have an if statement on what your doing. Saying if i select something do this else do this. i know you would always want to select something when running this command but if you didn't it would pop up with an error saying saying something about no SS1 selection set. with the if statement it would display

 

Nothing Selected

Edited by mhupp
Posted

thank you mhupp for the detailed explanation. I think that makes some sense to me. 

Posted

You might also look into vla-move and vla-rotate.

Posted

just FYI command that has vla or vlx needs to have (vl-load-com) added into the lisp for it work. doesn't really tell you that when looking up the commands.

Posted

Is the vla vlx better performance when used with certain commands? 

Posted

They can be Im sure someone can run a test to tell you how many milsec better one is over the other lol. For a simple move command it wouldn't be much.

Posted
On 6/23/2021 at 6:58 PM, mhupp said:

They can be Im sure someone can run a test to tell you how many milsec better one is over the other lol. For a simple move command it wouldn't be much.

 

which if course depends what you want the LISP to do. If you are modifying 1 entity then a millisecond will mean nothing, if you are changing 100,000 in a single drawing and then it could be significant. Yes, every now and then someone will post a test showing how one method is quicker than another, usually with a loop several thousand times long, VLA and VLAX seams to have a speed advantage. Another factor is how complex the routine is, many lines or loops and you will get a performance advantage.

 

I tend to take the attitude that I'll use whichever method I can understand and get working and that a little performance isn't going to be a huge issue for me, I can waste milliseconds getting a cup of coffee or (dare I say it) looking at Cadtutor.net when I should be doing work.

  • Funny 1

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