Suppoese I have series of catalogue drawings of AssemblyA.dwg and AssemblyB. dwg that are completed. (Each set contains a lot of version.)
And I need to create an Assembly drawings called AssemblyA-B.dwg which contains AssemblyA.dwg and AssemblyB. dwg as subassemblies. I need to create an automatik task to create the all of combination of the AssemblyA-B.dwgs without manually copying and pasting the views. The code will place (or change in prepared template ) the views of the AssemblyA.dwg and AssemblyB. dwg into AssemblyA-B.dwg
Do you have a solution for ilogic or API? (I logic preferred)
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Hi Ulas,
Here is an iLogic code to copy view from one sheet to a sheet in another drawing.
You may need to tweak the view index and the file path to suit your needs.
Dim oSrcDwg As DrawingDocument oSrcDwg = ThisApplication.ActiveDocument Dim oDestDwg As DrawingDocument oDestDwg = ThisApplication.Documents.Open("D:\Temp\Inventor\MyProj\Axle\Test.dwg") Dim oView As DrawingView If oSrcDwg.ActiveSheet.DrawingViews.Count < 1 Then MsgBox ("No views found in the source drawing !") Return End If oView = oSrcDwg.ActiveSheet.DrawingViews(1) Dim oSheet As Sheet For Each oSheet In oDestDwg.Sheets oSheet.Activate Call oView.CopyTo(oSheet) Exit For Next Call oDestDwg.Save Call oDestDwg.Close(False)
Regards,
Balaji
@Balaji_Ram Thanks for this example, but I would like to go a step further. How should can we handle multiple views that depend on each other?
Example:
oSrcDwg.ActiveSheet.DrawingViews(1) = base view
oSrcDwg.ActiveSheet.DrawingViews(2) = Section from base view
I would like to copy the section + the base view to my new dwg. How should I handle this?
@Jef_E wrote:
@Balaji_Ram Thanks for this example, but I would like to go a step further. How should can we handle multiple views that depend on each other?
I would like to be able to do this, too. The copy/paste via Command Manager isn't a good solution. It's not pure-API, it's clunky, and it results in duplicates of the Views (with new Labels) rather than moving the Views themselves.
So I created an idea for this here: iLogic/API: Move or Copy multiple Drawing Views to different sheet at once.
Please consider giving it a vote.
Can't find what you're looking for? Ask the community or share your knowledge.