×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create Dimension with VBA in drafting

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 ?

RE: Create Dimension with VBA in drafting

(OP)
Thanks Fernando for your reply,

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

(OP)
In the drawing that I attached, there is a dimension between to holes, I want to set this dimension with VBA (without Selected by the user) ?

RE: Create Dimension with VBA in drafting

(OP)
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:
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

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.


RE: Create Dimension with VBA in drafting

(OP)
Thanks garzar for your suggest and your idea,

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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources