Jump to content

Recommended Posts

Posted

It thought it would be very simple but...

 

Goal: In AutoCAD 2008 (MAP), you have a 3D cloud and you want to navigate immediately to a certain point (target) in that cloud and give a good vizualization of the point in the cloud for 4 different views.

 

Problem: I never see any point in the field of view of the 4 viewports

 

Code:

 

'create a new viewport

Set objViewPort = ThisDrawing.Viewports.Add("AllViewports")

'split

objViewPort.Split acViewport4

 

For Each objCurrentViewport In ThisDrawing.Viewports

If objCurrentViewport.LowerLeftCorner(0) = 0 Then

If objCurrentViewport.LowerLeftCorner(1) = 0 Then

'this takes care of Front view

dblViewDirection(0) = 0

dblViewDirection(1) = -1

dblViewDirection(2) = 0

objCurrentViewport.Direction = dblViewDirection

objCurrentViewport.Target = targetPoint

ThisDrawing.Application.ZoomExtents

Else

'this takes care of Top view

dblViewDirection(0) = 0

dblViewDirection(1) = 0

dblViewDirection(2) = 1

objCurrentViewport.Direction = dblViewDirection

objCurrentViewport.Target = targetPoint

ThisDrawing.Application.ZoomExtents

End If

End If

If objCurrentViewport.LowerLeftCorner(0) = 0.5 Then

If objCurrentViewport.LowerLeftCorner(1) = 0 Then

'this takes care of 3D view

dblViewDirection(0) = 1

dblViewDirection(1) = -1

dblViewDirection(2) = 1

objCurrentViewport.Direction = dblViewDirection

objCurrentViewport.Target = targetPoint

ThisDrawing.Application.ZoomExtents

Else

'this takes care of Side view

dblViewDirection(0) = 1

dblViewDirection(1) = 0

dblViewDirection(2) = 0

objCurrentViewport.Direction = dblViewDirection

objCurrentViewport.Target = targetPoint

ThisDrawing.Application.ZoomExtents

End If

End If

Next

'make the viewport active

ThisDrawing.ActiveViewport = objViewPort

 

I guess there is something wrong with the understanding of target, viewdir etc. Also the ZoomExtents is not working for each viewport. Can someone help, please?!

 

Thank you!

W

Posted

This thread will probably get more response in the AutoLISP and VBA Customisation forum, I'm sure a moderator will kindly move it for you :)

 

That said, don't duplicate this thread within another forum - as this complicates matters.

 

Lee

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