What is the API for "Insert Part into Assy?"
What is the API for "Insert Part into Assy?"
(OP)
1)How to insert part/assy into current assembly through API?
All the functions I have found so far allow inserting already loaded parts... Say I know the file source. How to get to the place where SW asks for placement of component?
2)Not API question: some files show preview of model when dragging from Feature Palette. Why some don't?
Linqur
All the functions I have found so far allow inserting already loaded parts... Say I know the file source. How to get to the place where SW asks for placement of component?
2)Not API question: some files show preview of model when dragging from Feature Palette. Why some don't?
Linqur






RE: What is the API for "Insert Part into Assy?"
Question #2....Not API question: some files show preview of model when dragging from Feature Palette. Why some don't?
Some reason for this may that the SW file was created in another version. If it is a SW2000 file I do not believe that you will see a preview when opening it up in 2001+ until it is saved. Another reason may may that when this file was last opened their may have been a crash or improper shut down.
BBJT CSWP
RE: What is the API for "Insert Part into Assy?"
Could you elaborate on why? Just for my insane curiousity.
Just a thought...even if you make or get a program that inserts the component that you desire. You will still have to manually pick the faces or planes you want to use. So why spend the exhausting hours of making a program that does some of the steps for you. when in the long run your going to still have to tell it which face or plane you want to use. You could spend less time doing it manually rather than writing a program...just a thought.
I could be wrong on that though...
Best Regards,
Scott Baugh, CSWP
credence69@REMOVEhotmail.com
http://home.insightbb.com/~scott.baugh/
RE: What is the API for "Insert Part into Assy?"
Dim swApp As Object
Dim swAssy As Object
Dim swPart As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set swAssy = swApp.ActiveDoc
swApp.LoadFile2 "C:\Sw Temp Files\Part1.SLDPRT", ""
Set swPart = swAssy.AddComponent2("C:\Sw Temp Files\Part1.SLDPRT", 0, 0, 0)
'You could then use the pointer to the
'AssemblyDoc and PartDoc
'to relocate after it has been inserted == swAssy and swPart
End Sub
Bill Briggs, CSWP
RE: What is the API for "Insert Part into Assy?"
BBJT: I think it is a guite reasonable. I had doubts that
this might also depend on whether Mate Reference in created...(?)
SBaugh: Our files are situated in folders based on file
name. So if I decide to use part with certain code then I
deduct the file path from the code and from there on
I want to automate everything until mating.
BillBriggs: this seems at first look just what I have been looking for! I need to test it more.
br,
Llinqur