- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im writing a addon in c#. This addon needs to create a drawing from a part file that is active when i run the addon. It needs to create a view from a flat pattern in a idw.
below you find the relevant code. Most code is copyed from the help file and converted to c#.
Document oDoc = inv.ActiveDocument;// <-- assume this is a part document string templatePath = inv.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject); DrawingDocument oDrawDoc = (DrawingDocument)inv.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, templatePath); Sheet oSheet = oDrawDoc.ActiveSheet; NameValueMap oBaseViewOptions = inv.TransientObjects.CreateNameValueMap(); oBaseViewOptions.Add("SheetMetalFoldedModel", false); // <- if this is set to "true" it will work TransientGeometry oTG = inv.TransientGeometry; Point2d insertPoint = oTG.CreatePoint2d(15, 12); DrawingView oFrontView = oSheet.DrawingViews.AddBaseView( (_Document)oDoc, insertPoint, 1, ViewOrientationTypeEnum.kCurrentViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle, "", null, oBaseViewOptions);
The line "oBaseViewOptions.Add("SheetMetalFoldedModel", false);" is the option that tells inventor to create a flat pattern. This option only fails if i set it to "false". (if i set it to "true" the code runs with out any problems but i dont get a flat pattern.)
the error message is:
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
Can some one tell me what i should do different?
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Solved! Go to Solution.