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!

Cumulate dimensions with VBA (.catvba)

Status
Not open for further replies.

Thomas D

Mechanical
Jan 16, 2019
2
FR
Hello,

I want to make dimensions between a first point "Origine" and a second point ("Point.1") on horizontal axis and vertical axis, I made this and it works:

Code:
Sub CATMain()

 Set DrwDocument = CATIA.ActiveDocument 'drawingDocument1
 Set DrwSheets = DrwDocument.Sheets 'drawingSheets1
 Set DrwSheet = DrwSheets.ActiveSheet 'drawingSheet1
 Set DrwViews = DrwSheet.Views 'drawingViews1
 Set DrwView = DrwSheet.Views.ActiveView
 Set Fact2D = DrwView.Factory2D
 Set GeoElments = DrwView.GeometricElements
 Dim DrwDimensions As DrawingDimensions
 Set DrwDimensions = DrwViews.Item("Vue de face")
 Dim myElements
 Dim selpoints
 Dim MyDimension As DrawingDimension

 Set origine = GeoElments.Item("Origine")
 
 Set Point = GeoElments.Item("Point.1")

 myElements = Array(origine, Point)
 selpoints = Array(0, 0, 0, 0)
 Set MyDimension = DrwView.Dimensions.Add(catDimDistance, myElements, selpoints, catDimHoriz)
 Set MyDimension = DrwView.Dimensions.Add(catDimDistance, myElements, selpoints, catDimVert)

End Sub

there is the result:
Capture1_ghzu8d.jpg

But, I want cumulate dimensions like this:
Capture2_rcpyvn.jpg

I found CatDimMode with catDimCumulate for cumulate dimension in Catia doc, but I don't know how to apply it to "MyDimension".

Thanks in advance for your help

PS: Sorry for the possible English error I'm French
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top