Jump to content

Recommended Posts

Posted

I use my numpad to change views, and I want to keep my current selection active. Now I did this with the macro:

^C^C_-view _front;^C^C^P(sssetfirst nil (ssget "_P"))(princ)

But now it also selects my previous selection even if i had unselected it.

So I went looking to something like this:

(IF ([b]sset[/b])(^C^C_-view _top;sset^C^C^P(sssetfirst nil (ssget "_P")(princ)))(^C^C_-view _top));

But that didn't work, first I don't know if the if function works in macro and I have to make a autolisp file instead? Futher more I don't know wich if function I should use to check for selection.

In short I want to do this:

If selection is active: changeview and keep selection

If selection is not active just change view do not retrieve previous selection.

Posted

Try something like this...

 

(if (ssget "_I") (progn (command "_.-view" "_top") (sssetfirst nil (ssget "_P"))) (command "_.-view" "_top"))(princ)

Posted

LISP version (with all default views as a choice):

(defun c:Test (/ ss op)
 (setq ss (ssget "_I"))
 (initget 0 "Top Bottom Left Right Front bAck SW SE NE NW")
 (if (setq op (getkword "\nView option [Top/Bottom/Left/Right/Front/bAck/SW/SE/NE/NW]: "))
   (progn (command "_.-view" (strcat "_" op))
          (sssetfirst nil ss)
   )
 )
 (princ)
)

 

I'm not much of a button person (don't know if this will work), but if you are wanting to avoid creating a command that has to be loaded, and can get it to load it from a Toolbar, you can try this (anonymous function):

((lambda (ss / op)
  (initget 0 "Top Bottom Left Right Front bAck SW SE NE NW")
  (if (setq op (getkword "\nView option [Top/Bottom/Left/Right/Front/bAck/SW/SE/NE/NW]: "))
    (progn (command "_.-view" (strcat "_" op))
           (princ (strcat "\nView: \"" op "\""))
           (sssetfirst nil ss)
    )
  )
  (princ)
)
 (ssget "_I")
)

Posted

Fantastic idea BTW.:thumbsup:

 

Sadly, I never change from Top view.

Posted
Fantastic idea BTW.:thumbsup:

 

Sadly, I never change from Top view.

The numpad idea is from blender.org, it is very handy because you can map out the views pretty good on the numpad. I currently have them mapped under ctrl+numpad1 etc.

And now Thanks to you it works flawless.

 

So awesome to ignore the current line is not in current ucs blablabla, just switch view and do it again, no more looking for your selection using some cmd to get previous selection back on.

 

Thanks for your help and i hope more people will like it!

 

btw same code for zoom cmd:

(if (ssget "_I") (progn (command "_.zoom" "all") (sssetfirst nil (ssget "_P"))) (command "_.zoom" "all"))(princ)

Zoom all is under ctrl+numpad 5

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