×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Re: Macro to create an Isometric View on a CATDrawing

Re: Macro to create an Isometric View on a CATDrawing

Re: Macro to create an Isometric View on a CATDrawing

(OP)
thread560-401763: Macro to create an Isometric View on a CATDrawing

Hi, I figured I would join since this forum has helped me numerous times before.

In the referenced thread above, the OP asks how to create an Isometric View in a CatDrawing and set it to Raster mode. I had trouble with his formula to find vector1 to generate the Iso so I am posting what I found to work, and how to render the view as raster.

Be pre-warned, I am not a computer programmer by trade and my last VBScript class was 10+ years ago in high school. So my code may not be the most efficient or cleanest. Any tips are welcome. :)

Also, my script is .catvbs so my declarations do not have "as string", etc.

First, we need to modify some Catia Settings so the default view generation mode is Raster

CODE --> CATVBS

Dim settingControllers1
Set settingControllers1 = CATIA.SettingControllers
Dim settingRepository1
Set settingRepository1 = settingControllers1.Item("DraftingOptions")

Dim CurrentSetting1,CurrentSetting2,CurrentSetting3,CurrentSetting4
CurrentSetting1 = settingRepository1.GetAttr("CATDrwLODPrintMod")     'capture current setting for Drafting>View>raster print quality
CurrentSetting2 = settingRepository1.GetAttr("CATDrwRasterMod")       'capture current setting for Drafting>View>raster mode
CurrentSetting3 = settingRepository1.GetAttr("DrwGenerationModeVal")   'capture current setting for Drafting>View>view generation mode
CurrentSetting4 = settingRepository1.GetAttr("CATDrwLODVisuMod")         'capture current setting for Drafting>View>raster print quality
	
settingRepository1.PutAttr "DrwGenerationModeVal", 2                      'change to raster mode
settingRepository1.PutAttr "CATDrwRasterMod", 2                         'change to shading with edges
settingRepository1.PutAttr "CATDrwLODPrintMod", 1                        'normal quality
settingRepository1.PutAttr "CATDrwLODVisuMod", 1                         'normal quality 

Let's get the vectors for the current 3D view, "Up" and "Sight"

CODE --> CATVBS

viewer3D1.viewpoint3D.GetUpDirection Up
viewer3D1.viewpoint3D.GetSightDirection Sight 

Now we need to find the cross product vector which gives us the missing leg of the trihedron

CODE --> CATVBS

Dim Sight0,Sight1,Sight2	
Sight0 = -1*( (Up(1))*(Sight(2)) - (Up(2))*(Sight(1)) )           'WARNING - this has worked in 4 tests, but further verification is needed to make sure the -1* is always needed
Sight1 = (Up(0))*(Sight(2)) - (Up(2))*(Sight(0))
Sight2 = -1*( (Up(0))*(Sight(1)) - (Up(1))*(Sight(0)) )           'WARNING - this has worked in 4 tests, but further verification is needed to make sure the -1* is always needed 

We can now generate the Iso view

CODE --> CATVBS

drawingViewGenerativeBehavior1.DefineIsometricView Sight0,Sight1,Sight2,Up(0),Up(1),Up(2) 

Finally, we revert the changed Catia Settings

CODE --> CATVBS

settingRepository1.PutAttr "CATDrwLODVisuMod", CurrentSetting4
settingRepository1.PutAttr "DrwGenerationModeVal", CurrentSetting3
settingRepository1.PutAttr "CATDrwRasterMod", CurrentSetting2
settingRepository1.PutAttr "CATDrwLODPrintMod", CurrentSetting1 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources