Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Macro for switch ImageViewMode between Exact View and Raster

Status
Not open for further replies.

Lea75

Mechanical
Feb 24, 2009
51
Dear all,
I need your help to find a solution for this issue.
I need to creat a macro that switches between 2 states of the active view mode in my Drawing: Exact View => Raster(with Shaging w/edges, and High Quality) => Exact view again
Here's my current code.
It changes the active view to RASTER, but I don't know how to change options to "Shading w/edges" and "Hight Quality"...
... then when I try to return to Exact View, the code turn off the Raster mode and change to CGR...

Any suggestion?


Set CATIA = GetObject(, "CATIA.Application")
If TypeName(CATIA.ActiveDocument) = "DrawingDocument" Then

If CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeOff Then
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ColorInheritanceMode = cat3DColorInheritanceModeOn
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeHRD
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.Update
Call calctemp(start_time)
Exit Sub
ElseIf CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeHRD Then
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ColorInheritanceMode = cat3DColorInheritanceModeOff
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeOff
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.Update
Call calctemp(start_time)
Exit Sub
End If

End If
 
Replies continue below

Recommended for you

Hi ,

do you try with :

(From CAA V5 Visual Basic help)

CatRepresentationMode (Enumeration)
enum CatRepresentationMode {
catExactMode,
catPolyhedricMode,
catVisualMode
}

Representation mode of a generative view.

Values:
catExactMode
View is generated from topological data
catPolyhedricMode
View is generated from CGR data, with polyhedric hidden line remover algortihm
catVisualMode
View is generated from CGR data, with an algorithm which uses the graphic card.


Regards
Marc
 
Hi Marc,
I'm afraid that I am not able to use that information with my project.
Do you have any example?
The CAA V5 Visual Basic Help is not so commplete about this issue and I am not an expert with it.
Thank you anyway
Regards
 
Yes, I did...
It seems this is an unsolved mistery.
How is possible this guy have 6 constants instead the 2 we have?...Hope someday an expert can help us with it.
Until then this is the nearest I could reach


If CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeOff Then
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ColorInheritanceMode = cat3DColorInheritanceModeOn
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.ImageViewMode = catImageModeHRD
CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.GenerativeBehavior.Update
CATIA.StartCommand ("Fit All In")
CATIA.StartCommand ("Properties")

... From this, the Properties dialog open and I can change to "Shading with edges" and "High Quality" options manually

I'll expect for the miracle.
Thanks for your replies.

 
I've tried with a newer release (R2021) and there are the 6 constants mentioned in the post It seems it's a matter of release, so D.S. expanded the options of this command.
Now I'll have to evaluate if it is worth to update my Catia release to this new one.
Thank you Little Cthulhu for show me the way ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor