Announcements
IMPORTANT. Forum to be archived in several phases. You can no longer submit new questions - but can only answer existing threads until Oct 17th 2016. Please read this message for details
Mechanical Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VBA - MDT 6 Error cteating a Mate constraint

0 REPLIES 0
Reply
Message 1 of 1
zdanovich
609 Views, 0 Replies

VBA - MDT 6 Error cteating a Mate constraint

Hi,

 

I have a problem. I want to create a Mate constraint between WorkPlane and McadPoint. I wrote this code:

 

Dim Patty As McadComponent
Set Patty=mcad.ActiveDocument.AssemblyMgr.RootDefinition.Children(0)

Dim Wplane As McadPlane, wpFeat As McadFeature,anyWP As McadPlane
For Each anyWP In Patty.definition.body.WorkPlanes
For Each wpFeat In anyWP.GetFeatures
If wpFeat.name Like "*Base#*" Or wpFeat.name Like "*base#*" Then
Set Wplane = anyWP: GoTo exF
End If
Next
Next
exF:
Dim pt As McadPoint
Dim utM As McadUtility
Set ut = ThisDrawing.Application.GetInterfaceObject("mcad.Application").ActiveDocument.Utility
Dim Val As McadValue: Set Val = ut.CreateValue

'------------------'
' '
' CODE '
' '
'------------------'
Dim C2 As IMcadGeometry: Set C2 = Wplane

Dim dM1 As McadConstraintDescriptor: Set dM1 = ut.CreateConstraintDescriptor(mcCompMate)
dM1.Operand1 = pt: dM1.Operand1Orientation = mcRaw: dM1.Operand2 = C2: dM1.Operand2Orientation = mcRaw
dM1.Value = Val
Dim M1 As McadComponentConstraint: Set M1 = kt.AddConstraint(dM1)


When I try to create a new constraint I get an error: -2147196502(800461aa) "Generic Failure to executo operation with provide arguments". I have to select WorkPlane without Pick.

Please, help me!

Thanks!

 

 

Tags (3)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report