Jump to content

How to set ISO view in an arbitrary UCS through Lisp


MJLM

Recommended Posts

I need what the title basically says. I want to set for example the SW view of my model when in a UCS through lisp. Having looked in the -view command I cant find something relevant, only the orthographic ones. Is there a way to set a system variable through a vector, say '(-1 , -1 , 1) ?

 

In suggestions appreciated.

Link to comment
Share on other sites

Are you asking how to create an isometric view relative to the current UCS in LISP?  In addition, do you want the option to choose one of the 8 possible views?

Link to comment
Share on other sites

3 hours ago, MJLM said:

I need what the title basically says. I want to set for example the SW view of my model when in a UCS through lisp. Having looked in the -view command I cant find something relevant, only the orthographic ones. Is there a way to set a system variable through a vector, say '(-1 , -1 , 1) ?

 

In suggestions appreciated.

 

do you mean

command -vpoint -1,-1,1 ?

 

(getvar 'viewdir) ;R.O

Link to comment
Share on other sites

I figured out I was using vla methods for that, that is...

 

(setq vw (vla-get-activeviewport (setq *acdoc* (vla-get-activedocument (vlax-get-acad-object)))))
(vlax-put vw 'direction '(-1.0 -1.0 1.0))
(vla-put-activeviewport *acdoc* vw)

 

I was using the WCS and all worked fine. Now in an arbitrary UCS where the xy plane is not coplanar with the WCS xy it does not. I m guessing the vector has to be expressed in WCS coordinates. I am using instead

 

(vlax-put vw 'direction (trans '(-1.0 -1.0 1.0) (trans '(0.0 0.0 1.0) 1 0 t) 0 t))

as my desired viewing direction is SW. But the result is not as expected. Any ideas?

Link to comment
Share on other sites

2 hours ago, MJLM said:

as my desired viewing direction is SW. But the result is not as expected. Any ideas?

 

try 

(vlax-put vw 'direction (trans '(-1.0 -1.0 1.0) 1 0 t) )

if ucs '(-1 1 1) , swap x y 

(trans '(1 -1 1) 1 0 t) 

untested i maybe wrong

 

 

Link to comment
Share on other sites

Thank you. I tested it as you suggested and it seems it is working but not totally. The axes come to the correct orientation but the model is coming upside down. In other words it needs 180 deg rotation around the perpendicular to the screen axis (considered crossing in the middle of the screen) to make it look good. Is it happening to me only?

 

FYI, the UCS I have is rotated once per Z-WCS then per Y-WCS.

Edited by MJLM
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...