We use a "Template" drawing located in our library folder were we can find our "Template" drawing blocks:
1. Click on the drawing
2. Click & Drag the block you want to import to your drawing
This is a fairly userfriendly method to import blocks to your drawing without having to open the drawing which contains the original blocks.
My Question: Is this method of importing blocks without having to open the original draft also possible using VB.net?
I want to import all template blocks to a drawing.
Currently I am using this method but this isn't really a feasible solution because SE opens and closes the draft which takes a lot of time:
dim objBlockDraft as SolidEdgeDraft.DraftDocument objBlockDraft = objApp.Documents.Open([File Path of template blocks drawing])
For i = 1 To objBlockDraft.Blocks.Count objBlock = objDraft.Blocks.CopyBlock(objBlockDraft.Blocks.Item(i)) Next
This code was derived from this topic: https://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/How-to-insert-a-Block-Occ...
Seeing that it is possible to import blocks without opening a drawing while using the UI, I can't help but wonder if this could also be possible using the SE API.
Thank you in advance for your help and input!
Solved! Go to Solution.
The "template" must always be opened, but you can do that in a silent way (same thing that SE does) with this option in Documents.Open:
objBlockDraft = objApp.Documents.Open([File Path of template blocks drawing],8)
It seems to work a bit faster indeed!
I changed my macro so it will only copy / "Import" those blocks if necessary.
You can also try this method :
objDraft.Blocks.AddBlockByFile([File Path of template blocks drawing])