Setting Target/Direction on Pviewport

Setting Target/Direction on Pviewport

dario_bellinazzi
Participant Participant
889 Views
2 Replies
Message 1 of 3

Setting Target/Direction on Pviewport

dario_bellinazzi
Participant
Participant

Hello,

i'm not getting the expected result with following test code regarding Viewport's Target/Direction:

(defun C:PVPTEST ( / acadObj docObj pSpaceObj ps_centerPt vp_targetPt vp_cameraPt vpObj)
  (setq acadObj     (vlax-get-acad-object))
  (setq docObj      (vla-get-ActiveDocument acadObj))
  (setq pSpaceObj   (vla-get-paperspace docObj))
  (setq ps_centerPt (vlax-3d-point (trans (getvar "VIEWCTR") 0 1)))
  (setq vp_targetPt (vlax-3d-point '(0.0 0.0 0.0)))
  (setq vp_cameraPt (vlax-3d-Point '(0.0 0.0 500.0)))
  (setq vpObj       (vla-AddPViewport pSpaceObj ps_centerPt 5.0 5.0))
  (vla-Display vpObj :vlax-true)
  (vla-put-CustomScale vpObj 0.02)
  (vla-put-Target vpObj vp_targetPt)
  (vla-put-Direction vpObj vp_cameraPt)
)

Resulting viewport should be targeting WCS origin, but I get this instead (Crosshair is on mspace WCS origin):

pierini_0-1622794492656.png

Same code works fine on other CADs, is there something I'm missing?

Attached you can find test drawing/function.

 

Thank you for your help.

0 Likes
890 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor

This is the VBA forum. You want the lisp forum here.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

dario_bellinazzi
Participant
Participant

Ok. I thought this was the right forum, since the code is LISP flavor of ActiveX/COM API.

Going there then.

0 Likes