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
I recorded a CatScript to set a dimension between two holes (for the picture in the last post) :
[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:
[highlight #FCAF3E]Set drawingDimensions1 = drawingView1.GetItem("")[/highlight]
[highlight #EF2929]GetItem("between what ?!")[/highlight]
I can't extract Items (Holes) name or type! how can I do this ?
Here is an idea:
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.
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!