Choosing open model for placing baseview?

Choosing open model for placing baseview?

Anonymous
Not applicable
549 Views
7 Replies
Message 1 of 8

Choosing open model for placing baseview?

Anonymous
Not applicable

Hi all,

 

Currently, I have a code in a line for adding a baseview, it reads:

 

SyntaxEditor Code Snippet

oView1 = oSheet.DrawingViews.AddBaseView(oModel,oViewLoc, oViewScale, ViewOrientationTypeEnum.kLeftViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)

Right now, for development purposes, I have oModel as a part document that is specified by a string for the pathname, i.e.

 

SyntaxEditor Code Snippet

Dim oModel As PartDocument
Dim oModelName As String = "C:\Users\buntroh\Documents\Seal sleeve 2.ipt"
oModel= oDocs.Open(oModelName, False)

 However, I want to replace this string with the filepath of a part file that is open in the same collection of documents.

 

To clarify, just like how when you normally start a new drawing after finishing a part in a part file, the drawing automatically recognizes that 'newly created' model as the model to use when placing a new view. I just want to achieve the same thing (except since I am using iLogic to place the views, I have to specify the model document to use when placing the view).

 

Currently I have a rule that in my part document that is triggered when the user presses "Create Drawing". The rule prompts the user to save and then it opens up the drawing template. If theres a way to pass the newly created file path into my drawing document, that would be amazing.

 

Thanks

0 Likes
Accepted solutions (1)
550 Views
7 Replies
Replies (7)
Message 2 of 8

MechMachineMan
Advisor
Advisor

If you dont want the rule to be ran from the part document that you are going to make a drawing of, then when do you want it to be run?


--------------------------------------
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 3 of 8

Anonymous
Not applicable

I needed it to be run from the drawing document. I was under the notion that you can only run a rule that executes actions like placing base views and section views in a drawing document.

The only thing I need passed from the part document to the drawing document is the model/filepath itself.

0 Likes
Message 4 of 8

MechMachineMan
Advisor
Advisor
Accepted solution
True, but from the part doc you can Add a new drawing document based upon
the template you want to use and use ft hat mew document.

When you call it, you can also use is variable from there. Ie:

oDwgDoc = ThisApplication.Documents.Add (?,?)

--------------------------------------
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 8

Anonymous
Not applicable

Hmm... this actually helps a lot. I made this rule sometime ago, before I discovered the VB editor/object browser. Currently, I was using some weird VB command like system.diagnostics.process.start("filepath") to open my drawing template.

 

I still need your help though, because it is still not opening a new document with the "add" command. Here is what I have:

 

SyntaxEditor Code Snippet

ThisApplication.documents.add(kDrawingDocumentObject, "STSH Standard 2015 experiment.idw", True)

 

0 Likes
Message 6 of 8

MechMachineMan
Advisor
Advisor
Give the full file location of the template rather than just the name.

--------------------------------------
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 7 of 8

Anonymous
Not applicable

Thank you so much!

 

Another quick question, whats the method to call the part file into a iLogic rule in my drawing doc? Say, if I want to use some of the part doc's parameters as variables in my drawing doc? As far as getting the file name/path of my part doc into my drawing doc goes, I think I know how to do that.

0 Likes
Message 8 of 8

MechMachineMan
Advisor
Advisor
oDoc = ThisApplication.Documents.ActiveDocument 'for use when you first
start rule in part doc

oDoc = ThisApplication.Documents.Documents.ItemByName (FullFileName)

Or
oDoc =ThisApplication.Documents.Open (FullFileName, BooleanVisibility) in
conjunction with oDoc. Releasereference / close

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