Let’s Start Programming! Forums CATIA Macro Programming References to Geometry

This topic contains 2 replies, has 2 voices, and was last updated by  Cornel 3 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1100

    Cornel
    Participant

    In this example, a geometric object “MyPoint” and an object “MyComponenet” are defined.
    The name of the object should changed and a reference to the geometry is created.
    The name is displayed. The question is: What lines in the macro example is missing
    to work well?!

    Sub CATMain()

    MyPoint.Name = “Point.999”
    Dim Ref As Reference
    Set Ref = MyComponent.CreateReferenceFromGeometry (MyPoint)
    MsgBox (Ref.DisplayName)

    End Sub

    #1104

    Emmett Ross
    Keymaster

    I’m sorry but I’m not quite sure what you’re asking. Below is an example to show how to create an intersect then fill it in. I hope it helps:

    #1105

    Cornel
    Participant

    Hi! I want public your answer on the forum. Now it is more clear to me this exercise. Thank you very much.

    Sub CATMain()

    ‘activedocument must be a catpart
    Dim partdoc1 As Document
    Set partdoc1 = CATIA.ActiveDocument

    Dim part1 As Part
    Set part1 = partdoc1.part

    Dim hsf1 As Factory
    Set hsf1 = part1.HybridShapeFactory

    Dim myPoint As HybridShapePointCoord
    Set myPoint = hsf1.AddNewPointCoord(1.000000,0.000000,0.000000)

    MyPoint.Name=”Point.999″
    Dim Ref As Reference
    Set ref=part1.CreateReferenceFromGeometry (MyPoint)
    MsgBox (Ref.DisplayName)

    End Sub

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

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