Let’s Start Programming! Forums CATIA Macro Programming SetAbsoluteAxisData method

This topic contains 2 replies, has 2 voices, and was last updated by  Matt 2 years, 6 months ago.

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

    ald9351
    Participant

    I have tried to find this answer everywhere and everyones advice is exactly what i have entered. I’m sure with me being new, I am making some simple mistake.

    I preformed the Create_Sketch_01 tutorial. It works and I can run it on a new empty CATPart and everything works fine.

    However, when I try the tutorial Show_CreateLine_Form, and enter to code from the first macro, I get a compile error: Variable not defined. The error shows on the line

    “Set sketch1Variant = sketch1”

    ‘Set the axis system of the sketch
    ‘==========

    Dim arrayOfVariantOfDouble1(8)
    arrayOfVariantOfDouble1(0) = 0#
    arrayOfVariantOfDouble1(1) = 0#
    arrayOfVariantOfDouble1(2) = 0#
    arrayOfVariantOfDouble1(3) = 0#
    arrayOfVariantOfDouble1(4) = 1#
    arrayOfVariantOfDouble1(5) = 0#
    arrayOfVariantOfDouble1(6) = 0#
    arrayOfVariantOfDouble1(7) = 0#
    arrayOfVariantOfDouble1(8) = 1#

    Set sketch1Variant = sketch1
    sketch1Variant.SetAbsoluteAxisData arrayOfVariantOfDouble1

    Any help would be great. Thanks for your time.

    #1645

    ald9351
    Participant

    I guess taking a break helped. I noticed that at the top of my code I had Option Explicit. Took that out and it works. Hope this helps some other newbie at some point!

    #1702

    Matt
    Participant

    Option Explicit forces you to declare (Dim) every variable. You would need to Dim sketch1 in order to avoid the failure with Option Explicit on.

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

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