Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Copying views into another sheet (iLogic or API )

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ulasdeniz
2173 Views, 4 Replies

Copying views into another sheet (iLogic or API )

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)


Ulaş Deniz


Forumlarımızda çözülen sorularınızı "ÇÖZÜM OLARAK KABUL ET" ( "ACCEPT AS SOLUTION" ) seçimiyle işaretlemeyi lütfen unutmayın.
Beğendiğiniz mesajları lütfen "Övgü Puanı" (KUDO) ile ödüllendirin.
Youtube : https://www.youtube.com/channel/UCkJpVueGScmJvW1RIgqttSg

4 REPLIES 4
Message 2 of 5
Balaji_Ram
in reply to: ulasdeniz

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
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
Jef_E
in reply to: Balaji_Ram

@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?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 4 of 5
MechMachineMan
in reply to: Jef_E

Either select your base view first or use command manager

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 5 of 5
DRoam
in reply to: Jef_E


@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.

Post to forums  

Autodesk Design & Make Report