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: 

Drawing Creation - Flat Patterns

4 REPLIES 4
Reply
Message 1 of 5
Thomas.Long
222 Views, 4 Replies

Drawing Creation - Flat Patterns

I'm attempting to create drawings with a flat pattern view. My drawing creation works perfectly for front/back/side view creation, but for some reason it's saying that "The Parameter is incorrect" on the view creation line.

		'Create Drawing and place views
		Part_DrawingDoc = CreateDrawing_PlaceViews ("C:\Work\Designs\Templates\2013\Inventor Templates\Imperial\iBorderANSI-D_021 (PCR).dwg", 0, 0)

Function CreateDrawing_PlaceViews (Template As String, OffsetX As Double, OffsetY As Double)

	'Declare Variables
	'[
	Dim oBaseView As DrawingView
	Dim DrawingView As Double
	Dim oDrawDoc As DrawingDocument
	Dim oPartDoc As Document
	Dim oSheet As Sheet
	Dim oTG As TransientGeometry
	Dim oPoint1 As Point2d
	Dim Xscale As Double
	Dim Yscale As Double
	']

	'Getting assembly/Part and creating drawing based on specified template
	oPartDoc = ThisDoc.Document
	oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, Template, True)

	'Getting first sheet for view placement
	oSheet = oDrawDoc.Sheets.Item(1)
	
	'Creating view centerpoint in center of sheet
	'[
	oTG = ThisApplication.TransientGeometry
	CenterX = oSheet.Width/2 + OffsetX
	CenterY = oSheet.Height/2 + OffsetY
	']
	
	'Set points in order to get wanted View (ie. if 'Y' is the same and 'X' is greater or less, you will get a Side View)
	oPoint1 = oTG.CreatePoint2d(CenterX, CenterY)

	'Create the Base View
	oBaseView = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, 1, ViewOrientationTypeEnum.kFlatPivotRightViewOrientation, kHiddenLineRemovedDrawingViewStyle, "Master")
	oBaseView.Scale = Min(60 / oBaseView.Width, 20/ oBaseView.Height)

	'Return the Drawing Document (The assembly is still the active document so this variable will be used for all other functions meant to interact with the drawing)
	Return oDrawDoc
End Function


Any help at all would be much appreciated.

Thank you,

Labels (4)
4 REPLIES 4
Message 2 of 5
WCrihfield
in reply to: Thomas.Long

Hi @Thomas.Long.  Just checking, but is there actually a FlatPattern already present within your sheet metal model file?  If not, then you will have to create one there first, before you can make a view of it.  It says so right in the online help documentation.

DrawingViews.AddBaseView 

Besides the view orientation specification, there is also the final optional input variable that could be specified, which is a NameValueMap, and there is a specification option within that for specifying a flat view, instead of a folded view for sheet metal parts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5
_dscholtes_
in reply to: Thomas.Long

Not that this will solve your issue, but your function definition is missing the declaration of the return object (oDrawDoc / drawing document), e.g.:

 

Function CreateDrawing_PlaceViews (Template As String, OffsetX As Double, OffsetY As Double) As DrawingDocument

 

 

Message 4 of 5
Thomas.Long
in reply to: _dscholtes_

I actually don't need to return the drawing for this one, so I went ahead and removed that, but thank you!

Message 5 of 5
Thomas.Long
in reply to: WCrihfield

I do have a flat pattern in the model, I may add a check for that at some point, but right now I'm just working out the basics. I'm actually not super familiar with namevaluemaps in ilogic. I may look at that when I get some more time.

 

Thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report