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!

Dimension Line coordinate

Status
Not open for further replies.

USB Memory

Mechanical
May 28, 2020
44
JP
Hi all

I have a question about CATIA VBA.

I want to get a Dimension Line coordinate like (X and Y) in VBA.
There is the "MoveValue" method in "Dimension3D" object for changing a Dimension Line coordinate.
But I cant't find a current Dimension Line coordinate.
I think there are properties have the coordinate in somewhere.
If someone know or find it, let me know way to get the coordinate

This is a sample script bellow for only changing dimension coordinate.
If some same dimension names are exist, this script is not working.

Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument

Dim selection1 As Selection
Set selection1 = productDocument1.Selection

selection1.Search "CATTPSSearch.TPSDimensionAnnot.Name='Dimension.1',all"

Dim x As Double: x = 20
Dim y As Double: y = 0
Dim e As Long: e = 2
Dim rd As Long: rd = 0
Dim ano As Annotation
Set ano = selection1.Item(1).Value
Call ano.Dimension3D.MoveValue(x, y, e, rd)


Regards.
 
Replies continue below

Recommended for you

try:

Code:
Call ano.MoveValue(x, y, e, rd)

you should read your best friends, chm files in your code/bin catia install folder.

Eric N.
indocti discant et ament meminisse periti
 
Thanks for repling, itsmyjob.

I have checked CATIA Help(popup by F1 Key) but still could not find the way to get the current coordinate of Dimension Line.
My understanding is that MoveValue is for only changing the coordinate with a parameters taken.
I wonder how to get the "current" coordinate.
There is a GetBoundaryBox method and it's described "Get boundary box coordinates of dimension value."
The GetBoundaryBox method is colose to my requirements.
But I don't know how to get this method working.

Could you inform me of the way to get the coordinates of dimension, if you know.

Regards
 
Code:
Dim myDrawingRoot As DrawingRoot
Set myDrawingRoot = CATIA.ActiveEditor.ActiveObject

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = myDrawingRoot.Sheets.Item("Sheet.1")

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingDimensions1 As DrawingDimensions
Set drawingDimensions1 = drawingViews1.Item("FRONT")

Dim drawingDimension1 As DrawingDimension
Set drawingDimension1 = drawingDimensions1.Item("Dimension.2")

Dim oValues(7)

Dim variantDim
Set variantDim = drawingDimension1

variantDim.GetBoundaryBox (oValues)

Eric N.
indocti discant et ament meminisse periti
 
Thank you for the details. I really appreciate it.

I ended up to get the current coordinate by using a GetBoundaryBox.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top