Jump to content
MJLM

How to set ISO view in an arbitrary UCS through Lisp

Recommended Posts

MJLM

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.

Share this post


Link to post
Share on other sites
lrm

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?

Share this post


Link to post
Share on other sites
hanhphuc
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

Share this post


Link to post
Share on other sites
MJLM

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?

Share this post


Link to post
Share on other sites
hanhphuc
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

 

 

Share this post


Link to post
Share on other sites
MJLM
Posted (edited)

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

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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