Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

macro drafting 1

Status
Not open for further replies.

hajar1

Industrial
Jun 25, 2019
7
FR
hi
I nees help
i try to make a macro that consists of making a drafting with views (front view, left view and a cut) and associate each catpart a special color
any suggestion?
thank you in advance
 
Replies continue below

Recommended for you

Why don't you use Catia's "View Creation Wizard"?...….

image_mvibeg.png



It is very simple!



CAD 2015
 
yes i agree with you to use View Creation Wizard but my goal is to generate directly and automatically my drafting
the second thing at the level of the cut must at the same height every time
 
i have an update
i do a macro who creat front and right view of a catpart, know i wanna do the samething for a catproduct

Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior

drawingViewGenerativeBehavior1.SetGPSName "DefaultGenerativeStyle.xml"

Set documents1 = CATIA.Documents

'===============

strFilePath = CATIA.FileSelectionBox("Select part", "*.CATPart", 0)

If strFilePath = "" Then Exit Sub

Set partDocument1 = CATIA.Documents.open(strFilePath)

'===============
Set product1 = partDocument1.GetItem("Part1")
drawingViewGenerativeBehavior1.Document = product1
drawingViewGenerativeBehavior1.DefineFrontView 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000
drawingView1.x = 1500
drawingView1.y = 420.500000
drawingView1.Scale = 1.000000
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior
drawingViewGenerativeBehavior1.Update
drawingView1.Activate
Set drawingDocument1 = CATIA.ActiveDocument
Set drawingSheet1 = drawingSheets1.ActiveSheet
Set drawingViews1 = drawingSheet1.Views
Set drawingView1 = drawingViews1.ActiveView
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior
Set drawingView2 = drawingViews1.Add("AutomaticNaming")
Set drawingViewGenerativeBehavior2 = drawingView2.GenerativeBehavior
drawingViewGenerativeBehavior2.DefineProjectionView drawingViewGenerativeBehavior1, catfrontView
Set drawingViewGenerativeLinks2 = drawingView2.GenerativeLinks
Set drawingViewGenerativeLinks1 = drawingView1.GenerativeLinks
drawingViewGenerativeLinks1.CopyLinksTo drawingViewGenerativeLinks2
drawingView2.x = 594.500000
drawingView2.y = 420.500000
Dim double1
double1 = drawingView1.Scale
drawingView2.Scale = 1.000000
Set drawingViewGenerativeBehavior2 = drawingView2.GenerativeBehavior
drawingViewGenerativeBehavior2.Update
drawingView2.ReferenceView = drawingView1
drawingView2.AlignedWithReferenceView
Set specsAndGeomWindow1 = CATIA.ActiveWindow
Set specsViewer1 = specsAndGeomWindow1.ActiveViewer
specsViewer1.Reframe
specsViewer1.Reframe
End Sub

so i change the red statement by that but it doesn't work
Set product1 = productDocument1.GetItem("Product1")
also i wanna do a cut of front view i need help to do that
 
Your productDocument1 variable is empty, which means that it was not assigned properly. I do not see any line in your code where you assign ProductDocument into productDocument1 variable. Something like:

Code:
Set productDocument1 = CATIA.ActiveDocument

Tesak
- Play Tetris in CATIA V5 drawing
 
it's really strange, i do my assembly in DMU navigator so my code work but i had this message
Capture_vmxxsa.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top