VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting Target/Direction on Pviewport

2 REPLIES 2
Reply
Message 1 of 3
dario_bellinazzi
638 Views, 2 Replies

Setting Target/Direction on Pviewport

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.

Labels (4)
2 REPLIES 2
Message 2 of 3
Ed.Jobe
in reply to: dario_bellinazzi

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

Message 3 of 3
dario_bellinazzi
in reply to: Ed.Jobe

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

Going there then.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost