Jump to content

Is any way to get view name ?


andy_lee

Recommended Posts

Hello

Is any way to get view name in current drawing ?

 

top ,bottom,left,reght ,front , etc.

 

 

This code is change the object form left view to top view.

I want auto judge the current view name , and change the object to top view.

Thanks a lot .

 

(defun c:test(/ ss)
 (if(setq ss(ssget))
   (progn
     (setvar 'cmdecho 0)
     (command "_.rotate3d" ss "" "z" "non" "0,0,0" "90")
     (command "_.rotate3d" ss "" "x" "non" "0,0,0" "-90")
     (sssetfirst nil ss)
     (setvar 'cmdecho 1)
     )
   )
 )

Link to comment
Share on other sites

I don't believe that when a view is changed to left or right or bottom views etc... that it is stored as a named view as if you were to use the view command and save a named view.

 

One way that I can think of knowing whether it is top or left or what not, is to look at the VIEWDIR system variable.

 

For example: if

(setq vdir (getvar "VIEWDIR"))

returns ( 0 , 0 , 1.0) then you are looking at the top view. (0, 0, -1.0) = bottom

if it returns (0 , negativenumber , 0) you are looking at front

if it returns (0, positivenumber, 0) you are looking at the back

 

I hope this helps you in some sort of way.

 

regards,

 

Ben

Link to comment
Share on other sites

Perhaps you could use the command VPOINT.

 

This from my Help files

 

Define a 3D View with Coordinate Values or Angles

 

To set standard views with VPOINT (AEC convention)

 

On the command line, enter vpoint.

 

Enter a coordinate according to the viewpoint you want:

 

Enter 0,0,1 for a top (plan) view.

Enter 0,-1,0 for a front view.

Enter 1,0,0 for a right side view.

Enter -1,0,0 for a left side view.

 

Enter 1,-1,1 for an isometric view.

 

Command line VPOINT

 

Link to comment
Share on other sites

You're welcome, andy_lee

Glad I could help!

 

 

And, I know emk2012 is you... ;)

Henrique

 

Dear Henrique

You help me many times !All Very Much Appreciated!

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