Inventor Customization

Reply
Valued Contributor
dclunie
Posts: 70
Registered: ‎03-26-2008
Message 1 of 4 (493 Views)

Ilogic View Reps on dwg

493 Views, 3 Replies
12-19-2012 10:37 PM

HI

 

I am after help on some ilogic code ,I have had some code done to isolate selected parts in a assembly file that has a specific custom property filled in i.e. : DESC2.It then creates view reps and locks down giving the rep name the same name as part.

 

What I am after if any one can help is some code that will place these isolated view reps as views on my dwg that the assembly resides in.With the functionality of picking face to show plan view of parts.

 

Any thoughts would be appreciated.

 

Dave

 

 

 

ADN Support Specialist
xiaodong.liang
Posts: 1,263
Registered: ‎06-12-2011
Message 2 of 4 (442 Views)

Re: Ilogic View Reps on dwg

01-14-2013 08:25 PM in reply to: dclunie

Hi,

 

If I understand correctly, you want to place the drawing views from one assembly in specific view reps (or even specific LOD etc) like UI does (see attachment). If yes, you could use Advanced API of ilogic to access Inventor API. DrawingViews.AddBaseView allows you to specify additional or advanced options:

 

Name 
Value Type 
Valid Document Type 
WeldmentFeatureGroup 
Weldment 
SheetMetalFoldedModel 
Boolean 
Sheet Metal 
String 
Part, Assembly 
DesignViewAssociative 
Boolean 
Part, Assembly 
String 
Assembly 
MemberName 
String 
Part, Assembly 
PresentationView 
String 
Presentation 
PresentationViewAssociative 
Boolean 
Presentation 

 

Following is a demo code I converted from the sample in the help reference of Inventor API:

 

' Set a reference to the drawing document. 
' This assumes a drawing document is active. 
Dim oDrawDoc As DrawingDocument 
oDrawDoc = ThisApplication.ActiveDocument 

'Set a reference to the active sheet. 
Dim oSheet As Sheet 
oSheet = oDrawDoc.ActiveSheet 

' Create a new NameValueMap object 
Dim oBaseViewOptions As NameValueMap 
oBaseViewOptions = ThisApplication.TransientObjects.CreateNameValueMap 

' Set the representations to use when creating the base view. 
'Call oBaseViewOptions.Add("PositionalRepresentation", "MyPositionalRep") 
Call oBaseViewOptions.Add("DesignViewRepresentation", "Default") 
'Call oBaseViewOptions.Add("DesignViewAssociative", True) 

' Open the model document (corresponding to the "MyLODRep" representation). 
Dim strFullDocumentName As String 
strFullDocumentName = ThisApplication.FileManager.GetFullDocumentName("c:\temp\reps.iam", "Master") 

Dim oModel As Document 
oModel = ThisApplication.Documents.Open(strFullDocumentName, False) 


' Create the placement point object. 
Dim oPoint As Point2d 
oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25) 

' Create a base view. 
Dim oBaseView As DrawingView 
 oBaseView = oSheet.DrawingViews.AddBaseView(oModel, oPoint, 2, _ 
kIsoTopLeftViewOrientation, kHiddenLineRemovedDrawingViewStyle, _ 
, , oBaseViewOptions) 

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
sergelachance
Posts: 170
Registered: ‎04-30-2012
Message 3 of 4 (242 Views)

Re: Ilogic View Reps on dwg

09-18-2013 03:25 AM in reply to: dclunie

Anybody know to take the designviewreprentation, to see if is a front, side, top view in a drawing?

same to that

CurrentOrientation = activesheet.View("View1").DesignViewRepresentation

 

Thnaks for your help!

Distinguished Contributor
sergelachance
Posts: 170
Registered: ‎04-30-2012
Message 4 of 4 (178 Views)

Re: Ilogic View Reps on dwg

10-25-2013 05:44 AM in reply to: sergelachance

Ok i have now :smileyhappy:

 

Dim odoc As DrawingDocument
odoc = ThisApplication.ActiveDocument
Dim tmpView As DrawingView

'Which text for which orientation
Select Case tmpView.Camera.ViewOrientationType
Case ViewOrientationTypeEnum.kBackViewOrientation
iProperties.Value("Custom", "TEST") = "Back View"
Case ViewOrientationTypeEnum.kBottomViewOrientation
iProperties.Value("Custom", "TEST")= "Bottom View"
Case ViewOrientationTypeEnum.kFrontViewOrientation
iProperties.Value("Custom", "TEST") = "Front View"
Case ViewOrientationTypeEnum.kIsoBottomLeftViewOrientation
iProperties.Value("Custom", "TEST") = "Iso - Bottom Left View"
Case ViewOrientationTypeEnum.kIsoBottomRightViewOrientation
iProperties.Value("Custom", "TEST")= "Iso - Bottom Right View"
Case ViewOrientationTypeEnum.kIsoTopLeftViewOrientation
iProperties.Value("Custom", "TEST") = "Iso - Top Left View"
Case ViewOrientationTypeEnum.kIsoTopRightViewOrientation
iProperties.Value("Custom", "TEST")= "Iso - Top Right View"
Case ViewOrientationTypeEnum.kLeftViewOrientation
iProperties.Value("Custom", "TEST") = "Left View"
Case ViewOrientationTypeEnum.kRightViewOrientation
iProperties.Value("Custom", "TEST")= "Right View"
Case ViewOrientationTypeEnum.kTopViewOrientation
iProperties.Value("Custom", "TEST") = "Top View"
Case Else
iProperties.Value("Custom", "TEST") = ""
End Select

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube