Create Dimension with VBA in drafting
Create Dimension with VBA in drafting
(OP)
Hello
Is it possible to create a dimension for a line or a circle or etc with VBA in drafting in Catia V5 ?
Is it possible to create a dimension for a line or a circle or etc with VBA in drafting in Catia V5 ?





RE: Create Dimension with VBA in drafting
Short answer is yes, you can search in v5automation.chm file "drawing dimension" to see something about this topic.
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Create Dimension with VBA in drafting
I searched in v5automation.chm, but I could not find a sample code about to create a dimension for a GeneratedItem in drafting. my problem is, how can I set a dimension for a specific GeneratedItem that I want, like a Line (GeneratedItem) or a circle with vba in drafting. I need a sample code ?
I want to select a specific GeneratedItem, like a line or a circle that I want to get dimension for it
Exactly my mean is
RE: Create Dimension with VBA in drafting
RE: Create Dimension with VBA in drafting
[Sub CATMain()
Dim drawingDocument1 As Document
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.Item("Front view")
Dim drawingDimensions1 As CATBaseDispatch
Set drawingDimensions1 = drawingView1.GetItem("")
Dim drawingDimension1 As DrawingDimension
Set drawingDimension1 = drawingDimensions1.Item("Dimension.1")
Dim boolean1 As Boolean
boolean1 = drawingDimension1.Forshortened
End Sub]
my problem is:
Set drawingDimensions1 = drawingView1.GetItem("")
GetItem("between what ?!")
I can't extract Items (Holes) name or type! how can I do this ?
RE: Create Dimension with VBA in drafting
In the model, create another sketch.
In that sketch put points at the center of the circles.
Create a length dimension between the points.
Make that dimension reference.(this creates something called a Measured Constraint)
On the drawing, use the Generate Dimensions tool.
Toggle OFF Sketcher Constraints.
Toggle ON Measured Constraints.
Toggle ON ....associated with unrepresented elements.
Click OK to create the "dimension". (which is really just showing the measured constraint)
This is a way to pre-dimension your drawing while still in the part.
RE: Create Dimension with VBA in drafting
your idea is effective but it requires some design considerations and I want to set a dimension for a Item (like a line or a circle or between two circles etc) with vba in drafting worbench. My question is, when I recorded CatScript for posted example, there is not name for Items!