How to put isometric view of drawing in colors and with Raster mode "Shading with edges"?

ZHEN FENG LI

How to put isometric view of drawing in colors and with Raster mode "Shading with edges"?

Hello all,

I'm trying to write a vba macro for Catia V5-6R2016 that put the isometric view of drawing with colors.

I cannot convert Raster mode from the default "Dynamic hidden line removal" to "Shading with edges".
Is there a way to do it?

Many thanks

 

Sub CATMain()


Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.ActiveView

If drawingView1.ViewType = catViewIsom Then

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.ColorInheritanceMode = cat3DColorInheritanceModeOn
drawingViewGenerativeBehavior1.ImageViewMode = catImageModeHRD
'Cannot access the controls for Raster Options here, need further searching

drawingViewGenerativeBehavior1.ForceUpdate

Else
        MsgBox ("The active view is not Isometric view")
        End
End If

End Sub

Dave Goerlitz

RE: How to put isometric view of drawing in colors and with Raster mode "Shading with edges"?
(in response to ZHEN FENG LI)

There is no way to do this completely in vb.  The only way that I have been able to do this is to:

1) have a start drawing previously created with the necessary view(s) with the desired display characteristics (raster, with color, edges no edges...) created and saved.  This is done interactively.

In VB(a)

2) open existing start drawing

3) update the links in the start drawing to the correct part / product

4) update drawing sheet

Code Snipet from vb.net:

            oDwgView = oDwgViews.Item(dwgViewName)

            drawingGenLinks = oDwgView.GenerativeLinks
            dwgViewGenBehavior = oDwgView.GenerativeBehavior

            Dim myNewLink 'As PartDocument

            myNewLink = CATIA.Documents.Item(oName)

            drawingGenLinks.RemoveAllLinks()
            drawingGenLinks.AddLink(myNewLink.Product)

ZHEN FENG LI

RE: How to put isometric view of drawing in colors and with Raster mode "Shading with edges"?
(in response to Dave Goerlitz)

Hi Dave,

Thanks for the info "no way". I'll stop putting more energy on this problem.

I like your trick, while it doesn't fit to our situation, because our drawings created daily are all different that we cannot use the same drawing views template.

Finally I modified my macro as below and leave the users to manually click the Raster options.

Sub CATMain()

' *****************************************************************************************
'
' Purpose: Set Catdrawing Isometric view 3D color
'
' Author: ZHEN FENG LI
' Date: Feburary 21, 2022
' CATIA Level: V5R26
' *****************************************************************************************

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.ActiveView

If drawingView1.ViewType = catViewIsom Then

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.ColorInheritanceMode = cat3DColorInheritanceModeOn
drawingViewGenerativeBehavior1.ImageViewMode = catImageModeHRD
'Cannot access the controls for Raster Options here, need further searching

drawingViewGenerativeBehavior1.ForceUpdate

'Open Properties window for manual clicks:
Dim sel
Set sel = drawingDocument1.Selection
sel.Clear
sel.Add drawingView1

CATIA.StartCommand "Properties"
Else
MsgBox ("The active view is not Isometric view")
End
End If

End Sub

Dave Goerlitz

RE: How to put isometric view of drawing in colors and with Raster mode "Shading with edges"?
(in response to ZHEN FENG LI)

Hi Zhen,

Don't forget you can always open the template, update the links then copy & paste into a new drawing. 

Glad you found a solution.

 

Regards,

Dave