Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to Create Plan View Camera (under View > Named Views) 1

Status
Not open for further replies.

lardman363

Automotive
Feb 8, 2013
173
US
I am in need of a VBA macro that creates a camera for a standard, 3rd angle projection, plan view (Looking in -Z, +Y is up, +X to the right), then I need to "activate" that view (so the part orients to the camera created)...but I a not sure where to start.
-I have point coordinates where I could set my ViewPoint3D (if that is possible)
-The -Z is the SightDirection
-The +Y is the UpDirection
Any help would be greatly appreciated.
 
Replies continue below

Recommended for you

Fernando,
This was exactly what I needed! I modified the "custom" view to the vectors I needed, and had to comment out the type on the Viewer3D (function marked as restricted) and it worked perfectly! Thanks!

Where are all these example scripts stored? I had to search for the file name you posted.
 
Do you have anything creating TPSview planes for 3-D annotations? I can create the views but I am having trouble orienting the views to make the text go in the direction I want.
 
that is tricky as API not documented if my memory is good.

Do you have code we can look at?

Eric N.
indocti discant et ament meminisse periti
 
Sure, so I thought the TPSViews were only related to how the geometry was oriented. So if I wanted to view my text in the plan view I needed to orient the geometry in the plan view before creating the TPSView.

So I would use the code above to orient to the plan view, create my annotation set, then I used the following code to create the view:

oSelection.Clear

oSelection.Add oPlane

oRefPlane = oSelection.Item(1).Reference

oView = oTPSFactory.CreateView(oRefPlane, 1)

oView.Name = "View Name"

oSelection.Clear

The view is created but the text was bout oriented properly. Horizontal was in the Y (up). There is a field in the TPSview definition (I'm using V5 R22) that allows you to align the horizontal of the view to a line...not sure how to access that in VBA though. The chm does not give good information on TPSViews.
 
i remember I had to first create a AXIS // to screen with vector matching screen vertical using ViewPoint3D.PutSightDirection and ViewPoint3D.PutUpDirection.
I used this axis in the creation of the view.

That was a while ago... have to go back to code to find out, but wont be able to share code (sorry)

Eric N.
indocti discant et ament meminisse periti
 
So I figured out if you create a plane from 2 lines that are perpendicular (pick horizontal then vertical), then create a TPSView on that plane, the view horizontal and vertical will match the plane's horizontal and vertical.
 
that's why we created an Axis that would match the screen orientation...

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top