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!

VBA Error : Extraction front view with reference to axis system and its plane.

Status
Not open for further replies.

ashish02112

Automotive
Sep 27, 2018
6
I am recording a macro but facing an issue while running it.

I created an axis system in 3D.
And now I am extracting a front view by first selecting the axis and then its plane so that UCS of that view will be that axis.

but after recording and running the same program again it is showing an error.
below is the script.

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.Item("Sheet.1")

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.Add("AutomaticNaming")

Dim drawingViewGenerativeLinks1 As DrawingViewGenerativeLinks
Set drawingViewGenerativeLinks1 = drawingView1.GenerativeLinks

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

Dim documents1 As Documents
Set documents1 = CATIA.Documents

Dim partDocument1 As PartDocument
Set partDocument1 = documents1.Item("Part1.CATPart")

Dim product1 As Product
Set product1 = partDocument1.GetItem("Part1")

drawingViewGenerativeBehavior1.Document = product1

Dim axisSystem1 As AxisSystem
' No resolution found for the object axisSystem1...

drawingViewGenerativeBehavior1.SetAxisSysteme Nothing, axisSystem1

drawingViewGenerativeBehavior1.DefineFrontView 0#, 1#, 0#, 0#, 0#, 1#

drawingView1.X = 594.5

drawingView1.Y = 420.5

drawingView1.[Scale] = 1#

Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.Update

drawingView1.Activate

End Sub


Please check the script and help me out.

Thanks in Advance.
 
Replies continue below

Recommended for you

Recording a macro is a very good way to get some code to start with.
Sadly,the code you get is usually missing some definition.

That's when you need to work with the other tools, the forum here is one of them but I would first try to get some info on the automation.chm file in your [catia]/code/bin folder.

The AxisSystem is missing, check the chm file to see how you can try to get this fixed...

Also, as you can see from the recording, DrawingViewGenerativeBehavior.DefineFrontView is used ... try to get some info from that in the chm file, it can help you get what you want.

Eric N.
indocti discant et ament meminisse periti
 
Thanks, But I am new to VBA. I don't have that much knowledge of automation.chm and how to create a macro by reading that file.
will you please assist me.
 
i would suggest you find on youtube or on other platform some training on VBA...You dont need much, 5-10 hours of video + exercises would do, or ask your boss to get you a training.

Once you have a minimum of VBA & Object Oriented Programming understanding then we can start talking, this forum is more for CATIA problem (including CATIA VBA problem) than for VBA training...

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

Part and Inventory Search

Sponsor