I'm trying to write a VB application that generates an assembly from
existing parts, which are modified according to user-input.
I've come to the point where I want to mate the parts...
I couldn't get faces selected, so I used a reference plane, if anyone
knows how to adress a face directly, please tell me!
Below is a piece of code to add a coincident and a concentric mate. In
Solidworks, mates are added under the parts "Verbindingsstuk-1" and
"O-ring-1". These generate the following errors:
WARNING: Coincident1:
This mate cannot be solved. Consider:
a) deleting this mate;
b) moving the assembly closer to the desired solution with dragging;
c) Adding more mates to further define the assembly;
d) Changing the mating scheme.
ERROR: Concentric1:
Circles are not concentric. Distance between centers is 550.5 mm.
If I afterwards suppres either mate, the unsuppressed mate works
without errors... How can I get my parts mated?
Code:
swApp.ActiveDoc.ClearSelection2 True
boolstatus = swApp.ActiveDoc.SelectByID("Plane5@Verbindingsstuk-1@" &
CurrentFileName, "PLANE", 0, 0, 0)
boolstatus = swApp.ActiveDoc.AndSelectByID("Plane1@O-ring-1@" &
CurrentFileName, "PLANE", 0, 0, 0)
Assembly.AddMate swMateCOINCIDENT, swAlignCLOSEST, 0, 0#, 0#
swApp.ActiveDoc.ClearSelection2 True
boolstatus =
swApp.ActiveDoc.SelectByID("Arc1@Diameter@Verbindingsstuk-1@" &
CurrentFileName, "EXTSKETCHSEGMENT", 0, 0, 0)
boolstatus = swApp.ActiveDoc.AndSelectByID("Arc1@Diameter@O-ring-1@"
& CurrentFileName, "EXTSKETCHSEGMENT", 0, 0, 0)
Assembly.AddMate swMateCONCENTRIC, swAlignCLOSEST, 0, 0#, 0#
swApp.ActiveDoc.ClearSelection2 True
Thank you, you're help is appreciated!
- posted
16 years ago