API Mate (3-Planes in part to 3-Planes in Assembly)
API Mate (3-Planes in part to 3-Planes in Assembly)
(OP)
I am trying to get my feet wet with API programming. I have recorded a simple macro which mates 3 planes on a part (FRONT, SIDE, TOP) to 3 planes on the assembly which it is contained in (PLANES have same names.)
I am trying to makes this macro generic so that user can select a floating part in a assembly and the macro will get part name and assembly name and take care of the mates accordingly. I am having trouble getting the assembly name for use in selecting the part planes
(i.e. Assy.AndSelectByID "Top@Part1-1@Assem1", "PLANE", 0, 0, 0)
Part1-1 can be found using Component.Name after using GetSelectedObject()
How do I get Assem1?
I ran across one technique but it puts .sldasm extension.
ANy help would be greatly appreciated.
I am trying to makes this macro generic so that user can select a floating part in a assembly and the macro will get part name and assembly name and take care of the mates accordingly. I am having trouble getting the assembly name for use in selecting the part planes
(i.e. Assy.AndSelectByID "Top@Part1-1@Assem1", "PLANE", 0, 0, 0)
Part1-1 can be found using Component.Name after using GetSelectedObject()
How do I get Assem1?
I ran across one technique but it puts .sldasm extension.
ANy help would be greatly appreciated.






RE: API Mate (3-Planes in part to 3-Planes in Assembly)
Dim swApp As Object
Dim Part As Object
Dim sAssyName As String
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
sAssyName = Part.GetTitle
sAssyName = Left(sAssyName, InStr(1, sAssyName, ".") - 1)
MsgBox sAssyName
Hope this helps.
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.