Greetings,
this is my first post on this forum so excuse my poor English and any mistake.Long story short, I am writing a code that creates an Isometric View from a CATPart on a CATDrawing and I am facing
[ol 1]
[li]The DefineIsometricView method need six parameters to be defined: iX1, iY1, iZ1, iX2, iY2 and iZ2. I was able to retrieve iX2, iY2 and iZ2 using the GetUpDirection method of a Viewpoint3D object but I can't find a way to retrieve the first vector components (iX1, iY1 and iZ1).[/li]
[li]After the creation of the Isometric View the macro need to change its properties. I can change almost all of them except for the view generation mode that has to be changed from "Exact" to "Raster" with the Raster Mode being changed to Shading. This image explains what I want the macro to do: Image. I can't change the 3D Wireframe option from "Can be hidden" to "Is always visible" either.[/li]
[li]EDIT: I just noticed another issue. I ran the macro on my computer and it worked "fine" the first time. The second time I couldn't select the "Join surface" (HybridShapeAssemble) and the macro freezes, I had to restart CATIA. any idea why this is happening, or how can I fix it? [/li]
[/ol]
I searched the internet and the V5 Automation help file but I couldn't find anything.Actually, after reading the properties from the DrawingView object in the V5 Automation file, I don't know if it is even possible to do what I need on Item 2.
This is the code I am currently working on:
Code:
Sub CATMain()
Dim Drawing1 As DrawingDocument
Set Drawing1 = CATIA.ActiveDocument
MsgBox ("Please select now the CATPart File")
Dim FilePath1 As String
FilePath1 = CATIA.FileSelectionBox("Select the CATPart File", "*.CATPart", 0)
If FilePath1 = "" Then Exit Sub
Dim Part1 As PartDocument
Set Part1 = CATIA.Documents.Open(FilePath1)
Set UserSel = Part1.Selection
UserSel.Clear
Dim varFilter(0) As Variant
varFilter(0) = "HybridShapeAssemble"
Dim Join1
Join1 = UserSel.SelectElement2(varFilter, MsgBox("Please select now the Join surface"), False)
Dim specsAndGeomWindow1 As SpecsAndGeomWindow
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Dim viewer3D1 As Viewer3D
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer
Dim viewpoint3D1
Set viewpoint3D1 = viewer3D1.Viewpoint3D
Dim Up(2)
viewpoint3D1.GetUpDirection Up
UserSel.Clear
Drawing1.Activate
Dim Sheet1 As DrawingSheet
Set Sheet1 = Drawing1.Sheets.ActiveSheet
Dim IsoView1 As DrawingView
Set IsoView1 = Sheet1.Views.Add("Isometric View")
Dim IsoView1GB As DrawingViewGenerativeBehavior
Set IsoView1GB = IsoView1.GenerativeBehavior
IsoView1GB.Document = Part1
IsoView1GB.DefineIsometricView 1, 1, 0, Up(0), Up(1), Up(2)
IsoView1.X = 172.5
IsoView1.Y = 150
IsoView1.[Scale] = 1 / 5
IsoView1GB.ColorInheritanceMode = cat3DColorInheritanceModeOn
IsoView1GB.Update
IsoView1.Activate
Dim Sel1 As Selection
Set Sel1 = Drawing1.Selection
Sel1.Search "(Name=Text.1),all"
Dim visProperties1 As VisPropertySet
Set visProperties1 = Sel1.VisProperties
visProperties1.SetShow catVisPropertyNoShowAttr
Sel1.Clear
Sel1.Search "(Name=Origin),all"
visProperties1.SetShow catVisPropertyNoShowAttr
Sel1.Clear
Sel1.Search "(Name=HDirection),all"
visProperties1.SetShow catVisPropertyNoShowAttr
Sel1.Clear
Sel1.Search "(Name=VDirection),all"
visProperties1.SetShow catVisPropertyNoShowAttr
Sel1.Clear
End Sub
Any help would be highly appreciated.
Regards,
Hugo.