AnsweredAssumed Answered

Macro to mate named coordinatesystem

Question asked by Viktor Lundström on Aug 18, 2016
Latest reply on Aug 23, 2016 by Viktor Lundström



I have an assembly with several parts that contain named coordinate system as in code below "INF_KST_BOTTEN".

I would like to run a Macro that regardless of part searches for predefined names of coordsys. and add coincident mates between them.


Is it possible to write a macro for this task? any pointers where i should begin?


I made a dirty recording to show what i want to do.

Dim swApp As Object



Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long



Sub main()



Set swApp = _




Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("INF_KST_BOTTEN@0665733908-1@0665733901/51520-00 Kolvstång 63 32 A-1@0665733908", "COORDSYS", 0, 0, 0, False, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("INF_KST_BOTTEN@0665733909-1@0665733901/105-1006 Botten plan 63-1@0665733909", "COORDSYS", 0, 0, 0, True, 0, Nothing, 0)

Dim myMate As Object

Set myMate = Part.AddMate5(20, -1, False, 0.13042791553402, 0.001, 0.001, 0.001, 0.001, 0.5235987755983, 0.5235987755983, 0.5235987755983, False, False, 0, longstatus)

Part.ClearSelection2 True




End Sub

Best Regards


/ Viktor