Import sketched symbol from a new existing template into an older drawing

Import sketched symbol from a new existing template into an older drawing

Anonymous
Not applicable
602 Views
6 Replies
Message 1 of 7

Import sketched symbol from a new existing template into an older drawing

Anonymous
Not applicable

Hello,

 

We have redesigned the format of our drawings, so we've created a new title block and sketched symbols, etc.

 

The problem is that we have to update all the old drawings to use the new format as well. I've figured out how to reliably import the new title block, but I'm trying to get a tolerance block from the new template inserted into the old drawing. Here's the code I have: 

 

SyntaxEditor Code Snippet

FileLocation = "C:\Vault\TEMPLATES\CURRENT TEMPLATE TEST\"

ThisDrawing.ResourceFileName = FileLocation + "IPS Machined Comp.idw"
ThisDrawing.KeepExtraResources = True

ActiveSheet.TitleBlock = "MKS IPS"

'========================================================='vvv this section isn't working vvv'=========================================================
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisDrawing.Document

Dim oSketchedSymbolDef As SketchedSymbolDefinition
oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("TIGHT TOLERANCE BLOCK")

Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet

Dim sPromptStrings(0) As String
sPromptStrings(0) = "A"

oSheet.SketchedSymbols.Add(oSketchedSymbolDef, _
    ThisApplication.TransientGeometry.CreatePoint2d(ActiveSheet.Width - 8.9, 2.16),0, 1, sPromptStrings)
'========================================================='^^^ this section isn't working ^^^'=========================================================

If ActiveSheet.Size < "C" Then '   "A"<"B"<"C"<"D"
    ActiveSheet.ChangeSize("C", MoveBorderItems := True)
End If
0 Likes
603 Views
6 Replies
Replies (6)
Message 2 of 7

TA.Fehr
Advocate
Advocate

Would it not be easier to use the Drawing Resource Transfer Wizard? Whenever I have to update titleblocks that's what I use. It gives good control over what you wish to copy and avoid.

It is located in the Inventor 2015\Bin file

Message 3 of 7

MechMachineMan
Advisor
Advisor
Declare things explicitly instead of doing inline calls as it makes things go MUCH MUCH smoother.

Dim oPT as Point2d
oPT = ThisApplication.TransientGeometry.CreatePoint2d(ActiveSheet.Width - 8.9, 2.16)
oSheet.SketchedSymbols.Add(oSketchedSymbolDef, oPT, 0, 1, sPromptStrings)

--------------------------------------
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
0 Likes
Message 4 of 7

Anonymous
Not applicable

Oh really? Why does it matter?

0 Likes
Message 5 of 7

MechMachineMan
Advisor
Advisor
It just is way more reliable if every variable knows what data type it is supposed to be.

--------------------------------------
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
0 Likes
Message 6 of 7

Anonymous
Not applicable
I didn't even think about that. I would still have to go through each drawing and shift things around though. Plus, I'd have to check every file out, right?
0 Likes
Message 7 of 7

Anonymous
Not applicable

I appreciate the alternative method, but I can't check out the entire vault over the weekend as it's kind of large. We tried to do an all-encompassing conversion on a saturday a six months ago and it ended up lasting a whole month.

 

I was hoping for a more localized solution so that the new title block would be more of a "line in the sand" type of deal as opposed to a complete conversion for the entire vault. 

0 Likes