JamCAD Posted February 18, 2014 Posted February 18, 2014 I'm working on a lisp routine that requires creating a viewport in paperspace with an orientation. If I was doing it manually I would normally create the viewport and then from inside the viewport I would set "ucsfollow" to 1 and then change ucs, this will snap the viewport to the correct orrientation. See the snapshot if you find my explanation confusing Model space showing outline of viewport: Paper space showing actual viewport: I've been spending ages trying to work out how to create a view port with an orientation using lisp but got somewhat stuck. There seem to be a few options using vl/vlax but these only seem to specify the height, width, centre etc. and not the actually orientation. I would like to do most of the programming myself as a learning experience but any pointers in the right direction would be much appreciated. Quote
Lee Mac Posted February 18, 2014 Posted February 18, 2014 Here is a quick example to get you started: (defun c:test ( / sel ) (if (setq sel (ssget "_+.:E:S:L" '((0 . "VIEWPORT")))) (vla-put-twistangle (vlax-ename->vla-object (ssname sel 0)) (/ pi 3.0) ;; Angle in radians ) ) (princ) ) (vl-load-com) (princ) Quote
JamCAD Posted February 19, 2014 Author Posted February 19, 2014 Thanks Lee, Previously I had been looking through the dxf codes trying to work out which one to use. Somehow 51 had managed to escape my attention I'm going to try coding this a few ways using both your method and entmod and see how I go Quote
Lee Mac Posted February 23, 2014 Posted February 23, 2014 I'm going to try coding this a few ways using both your method and entmod and see how I go FYI, you cannot entmod a viewport Quote
JamCAD Posted February 24, 2014 Author Posted February 24, 2014 Ha ha thanks Lee, that explains why I was having trouble I was trying to avoid to using vlax/vla coding as I seem to have trouble understanding how to use it. However this thread seems to be very helpful http://www.cadtutor.net/forum/showthread.php?81195 Quote
ksperopoulos Posted February 25, 2014 Posted February 25, 2014 Do you know you can just rotate the viewport from paperspace to get the results you are looking for? No need for lisp unless you just want to. Quote
Lee Mac Posted February 25, 2014 Posted February 25, 2014 Ha ha thanks Lee, that explains why I was having trouble I was trying to avoid to using vlax/vla coding as I seem to have trouble understanding how to use it. However this thread seems to be very helpful http://www.cadtutor.net/forum/showthread.php?81195 You're welcome - I'm glad that my tutorial post on ActiveX is clear! Quote
Recommended Posts
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.