VBA-MDT 2004 Error creating a Mate constraint

Discussion in 'AutoCAD' started by Gaston, Sep 14, 2003.

  1. Gaston

    Gaston Guest

    I need to create a mate constraint between 2 workpoints placed into diferent components. The Components are at the same assembly level.

    I wrote code to get's the worpoints from each one component and to create the constraint descriptor. But when I try to create the new constraint in the first component, I get the error : -2147196502(800461aa) "Generic Failure to executo operation with provide arguments"

    Someone can helpme??? thanks in advance

    '==========================================================
    'Create a Mate restriction between 2 WorkPoints
    '==========================================================

    Dim oUtil As McadUtility

    Dim oRoot As McadComponentDefinition
    Dim oC1 As McadComponent 'Component 1
    Dim oC2 As McadComponent 'Component 2

    'Get Utility and root definition
    Set oUtil = oMDTDoc.Utility
    Set oRoot = oMDTDoc.AssemblyMgr.RootDefinition

    'Gets Comp 1 and 2
    Set oC1 = oRoot.Children(0)
    Set oC2 = oRoot.Children(1)

    'Gets the Workpoints
    Dim oC1Part As McadPart
    Dim oWkp1 As McadPoint

    Set oC1Part = oC1.Definition.Body
    Set oWkp1 = oC1Part.WorkPoints(0)

    Dim oC2Part As McadPart
    Dim oWkp2 As McadPoint

    Set oC2Part = oC2.Definition.Body
    Set oWkp2 = oC2Part.WorkPoints(0)

    'Creates Descriptor
    Dim oCnsDes As McadConstraintDescriptor
    Set oCnsDes = oUtil.CreateConstraintDescriptor(mcCompMate)

    oCnsDes.Operand1 = oWkp1
    oCnsDes.Operand1Orientation = mcRaw

    oCnsDes.Operand2 = oWkp2
    oCnsDes.Operand2Orientation = mcRaw

    oCnsDes.Value = 0

    oC1.AddConstraint oCnsDes
     
    Gaston, Sep 14, 2003
    #1
  2. Gaston

    Gaston Guest

    Posting again the code to avoid format lose.. (I hope...)

    And.... Please HELP!!!!!!!!

    '==========================================================
    'Create a Mate restriction between 2 WorkPoints
    '==========================================================

    Dim oUtil As McadUtility

    Dim oRoot As McadComponentDefinition
    Dim oC1 As McadComponent 'Component 1
    Dim oC2 As McadComponent 'Component 2

    'Get Utility and root definition
    Set oUtil = oMDTDoc.Utility
    Set oRoot = oMDTDoc.AssemblyMgr.RootDefinition

    'Gets Comp 1 and 2
    Set oC1 = oRoot.Children(1)
    Set oC2 = oRoot.Children(0)

    'Gets the Workpoints
    Dim oC1Part As McadPart
    Dim oWkp1 As McadPoint

    Set oC1Part = oC1.Definition.Body
    Set oWkp1 = oC1Part.WorkPoints(0)

    Dim oC2Part As McadPart
    Dim oWkp2 As McadPoint

    Set oC2Part = oC2.Definition.Body
    Set oWkp2 = oC2Part.WorkPoints(0)

    'Creates Descriptor
    Dim oCnsDes As McadConstraintDescriptor
    Set oCnsDes = oUtil.CreateConstraintDescriptor(mcCompMate)

    oCnsDes.Operand1 = oWkp1
    oCnsDes.Operand1Orientation = mcRaw

    oCnsDes.Operand2 = oWkp2
    oCnsDes.Operand2Orientation = mcRaw

    oCnsDes.Value = 0

    oC1.AddConstraint oCnsDes
     
    Gaston, Sep 15, 2003
    #2
  3. Gaston

    Anne Brown Guest

    Gaston -

    The formatting shows correctly on the NNTP newsgroup side of the
    groups.

    Unfortunately the HTTP web side of the newsgroups is not allowing
    carriage returns to show properly. Messages there show as one
    long line that just keeps wrapping. This is a known problem and
    scheduled for repair.

    If you are able to use the NNTP newsgroup reader side of the
    newsgroups, carriage returns show properly.

    A user posted this tip on properly spaced lines/paragraphs from
    the HTTP side:

    Place your text or code between a pair of PRE /PRE html tags:

    <PRE>

    Line 1
    Line 2
    Line 3

    </PRE>

    or

    If you're faced with one of those posts and want to get a clearer
    picture, a quick solution is to view the HTML source. If you're
    using another browser the commands might be slightly different,
    but for Internet Explorer right-click somewhere on the message in
    question and from the popup menu select View Source. Notepad will
    open up with the HTML source in it. Press F3 and search for
    something unique in the post. You will then see the message as
    the originator posted it in plain text.
     
    Anne Brown, Sep 15, 2003
    #3
  4. Gaston

    Kevin Terry Guest

    Do you have a file with an appropriately structured assembly that you can post to the customer files newsgroup? Then I can take a look for you.




    Kevin



    "Gaston" &lt;&gt; wrote in message news:...

    I apologize for my insistence, someone can helpme??

    I'm in a hurry.

    Thanks...
     
    Kevin Terry, Sep 17, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.