Community
I would like to determine the Proxy ObjectType returned from Constraint.EntityOne (i.e. If oConst.EntityOne = kWorkPointProxyObject Then ....)
Property EntityOne() As IDispatch**
Can someone provide direction or sample on how IDispatch works.
Dim oAsmDef As AssemblyComponentDefinition Set oAsmDef = oAsmDoc.ComponentDefinition
Dim oConst As AssemblyConstraint
For Each oConst In oAsmDef.Constraints 'Below will print the Enum 67120288 (kEdgeProxyObject) or 67119520 (kFaceProxyObject) if
'it is constrained. It will Err if a Work or Sketch Proxy Object is Constrained Debug.Print oConst.EntityOne Debug.Print oConst.EntityTwo Next
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
Two ways you could use. Please refer to the code below:
Sub test() Dim oAsmDoc As AssemblyDocument Set oAsmDoc = ThisApplication.ActiveDocument Dim oAsmCompDef As AssemblyComponentDefinition Set oAsmCompDef = oAsmDoc.ComponentDefinition Dim oConstraints As AssemblyConstraints Set oConstraints = oAsmCompDef.Constraints Dim oCons As AssemblyConstraint Set oCons = oConstraints(1) Dim oEntityOne As Object Set oEntityOne = oCons.EntityOne 'way1 If TypeOf oEntityOne Is EdgeProxy Then End If 'way2 Dim objType As ObjectTypeEnum objType = oEntityOne.Type If objType = kEdgeProxyObject Then End If End Sub
Thank you! This helps greatly. Is one better than or allow more or less option than the other.
Best Regards,