Jump to content

Help with vba instructions for visualstyle and zoom


Dante Sparda

Recommended Posts

Hi everybody, I'm doing an aplication with vba, and autocad opens automatically, always in 2d wire visual style, so I need to change it to conceptual or realistic with vba.

And after I insert some blocks (in 0,0,0) they are not completely visible, so I need to zoom all, also with vba.

And finally, how do I set the viewpoint to be isometric from, I'm not quite sure hot to say it, let's saay... isometric from front-right

 

I really need this, hope anyone can help me

 

thanks in advance!!!!

Link to comment
Share on other sites

Hi everybody, I'm doing an aplication with vba, and autocad opens automatically, always in 2d wire visual style, so I need to change it to conceptual or realistic with vba.

And after I insert some blocks (in 0,0,0) they are not completely visible, so I need to zoom all, also with vba.

And finally, how do I set the viewpoint to be isometric from, I'm not quite sure hot to say it, let's saay... isometric from front-right

 

I really need this, hope anyone can help me

 

thanks in advance!!!!

 

Not tested, maybe some mistakes here

partially borrowed from Help

 

Option Explicit

Sub Test()
Dim blkRef As AcadBlockReference
Dim varPt(0 To 2) As Double
Dim i As Integer

For i = 0 To 2
varPt(i) = 0
Next

Set blkRef = ThisDrawing.ModelSpace.InsertBlock(varPt, "MyBlock", 1, 1, 1, 0)
   

   Dim vdir(0 To 2) As Double
   vdir(0) = -1: vdir(1) = -1: vdir(2) = 1

   ThisDrawing.ActiveViewport.Direction = vdir
   ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
   
   Dim minExt As Variant
   Dim maxExt As Variant
   
   blkRef.GetBoundingBox minExt, maxExt
   ZoomWindow minExt, maxExt
   
   ThisDrawing.Regen acActiveViewport

End Sub

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