Let’s Start Programming! Forums CATIA Macro Programming Create Coordinate Dimension with text

This topic contains 5 replies, has 3 voices, and was last updated by  niklas.eisele@gmail.com 2 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1567

    Hi everybody.

    I’m pretty new at VBScripting so maybe this question is a bit basic but anyway =)

    I’m trying to create a script that enables me to chooose a point (or multiple points) and then the script should put coordinate dimensions on that point and then create a text on the inserted coordinate dimensions (not on the point because then it doesn’t follow the coordinate dimensions when they are moved). The text should be the name of the point selected.

    I’ve gotten this far:
    Option Explicit
    Sub CATMain()
    Dim oSel As Selection
    Set oSel = CATIA.ActiveDocument.Selection
    Dim i As Integer
    For i = 1 To oSel.Count
    Dim oSelEl As SelectedElement
    Set oSelEl = oSel.Item(i)
    MsgBox “Name ” & oSelEl.Value.Name
    Next i
    CATIA.StartCommand “Coordinate Dimensions”
    CATIA.StartCommand “Text”
    End Sub

    However this does automaticly choose the inserted coordinate dimensions or enter the name of the point.

    Any help would be appreciated =)


    Emmett Ross

    Hi Niklas. The first step is to choose a point or multiple points – how do you want to accomplish that? By user selection before the macro is started, by user selection while the macro is running, or automatically with macro searching for points by name or type?


    Hi Emmet. The point, or points, could be selected before the macro is started. I want the text to be the name of the point. There is no need to search automatically for the point since the names doesn’t allways follow a strict nomenclature.


    Anyone got any ideas? Anything would help =)



    3D annotation is not a simple task.

    For starters, to get the coordinates of a point use GetCoordinates to store coordinates in an array.

    ‘Select a point before running macro
    Dim aCoordinates(2) ‘array for point coordinates
    Dim oPoint

    Set oPoint = CATIA.ActiveDocument.Selection.Item(1).Value
    oPoint.GetCoordinates (aCoordinates)


    Thanks Matt

    I think I’ll simply rethink how I do this and use standard coordinate dimension instead. Thanks anyway!

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘CATIA Macro Programming’ is closed to new topics and replies.