Export single drawingview to autocad dwg

Export single drawingview to autocad dwg

Jef_E
Collaborator Collaborator
669 Views
3 Replies
Message 1 of 4

Export single drawingview to autocad dwg

Jef_E
Collaborator
Collaborator

Hi,

I am looking for a way to export a single drawingview to a AutoCad dwg. I can make a work around where I Copy the view to a new drawing or sheet and export this. But maybe there is a cleaner solution?

 

DrawingView Object

The DrawingView object represents a drawing view on a sheet. It allows access to information about drawing views. See the article in the overviews section.

 

Methods

NameDescription
AlignMethod that aligns this view with the input drawing view. The method returns a failure if the view is already aligned. Use the Aligned property to check for this condition and to break existing alignment.
AlignAuxiliaryMethod that re-aligns an auxiliary view. The method fails if the view is not an auxiliary view.
CopyToMethod that copies this drawing view into the specified sheet. The new object is returned.
CreateOriginIndicatorMethod that creates the origin indicator for ordinate dimensions and hole tables. The specified input GeometryIntent object must be associated with this drawing view, otherwise this method will fail.
DeleteMethod that deletes the DrawingView.
DrawingViewToModelSpaceMethod that takes a 2d coordinate in drawing view space, and returns a Line in model space. Since this method transforms from 2D space to 3D space, there is insufficient information to obtain a 3D model point. Hence, this method returns a Line in the view direction on which the point lies. You may then use the FindUsingRay method to find the point(s) of interest.
DrawingViewToSheetSpaceMethod that takes a 2d coordinate in drawing view space, and returns a Point2d containing the coordinates of the point in sheet space.
GetAutomatedCenterlineSettingsMethod that returns the settings that define how automatic center lines and center marks are to be calculated for this view.
GetIncludeStatusMethod that gets the include status of the input object in the drawing view.
GetReferenceKeyMethod that generates and returns the reference key for this entity.
GetVisibilityMethod that gets the visibility of the input object in the drawing view.
GetWeldmentStateMethod that gets the weldment option for the drawing view. The method returns a failure if the referenced model does not contain weldments.
InsertInModelSpaceInserts the view geometry into model space only if the drawing lives in an Inventor DWG file.
ModelToDrawingViewSpaceMethod that takes a 3d coordinate in model space, and returns a Point2d object containing the coordinate point in drawing view space.
ModelToSheetSpaceMethod that takes a 3d coordinate in model space, and returns a Point2d object containing the coordinate point in sheet space.
MoveToMethod that moves this drawing view into the specified sheet. The moved object is returned.
RotateByAngleMethod that rotates the drawing view by the specified angle.
SetAutomatedCenterlineSettingsMethod that sets the automatic centerline and center mark settings for this view and creates the centerlines and center marks defined by the settings. The centerlines and center marks that were created are returned.
SetDesignViewRepresentationMethod that sets a design view representation for a drawing view of an assembly. This method fails for drawing views of parts and presentations and in the case where the model (assembly) is unresolved.
SetIncludeStatusMethod that sets the include status of the input object in the drawing view. This method automatically makes the object visible as well. After an object has been included, its visibility can be controlled using the GetVisibility and SetVisibility methods.
SetVisibilityMethod that sets the visibility of the input object in the drawing view.
SetWeldmentStateMethod that sets the weldment option for the drawing view. The method returns a failure if the referenced model does not contain weldments.
SheetToDrawingViewSpaceMethod that takes a 2d coordinate in sheet space, and returns a Point2d object containing the coordinate point in drawing view space.
SheetToModelSpaceMethod that takes a 2d coordinate in sheet space, and returns a Line in model space. Since this method transforms from 2D space to 3D space, there is insufficient information to obtain a 3D model point. Hence, this method returns a Line in the view direction on which the point lies. You may then use the FindUsingRay method to find the point(s) of interest.
ShowHiddenAnnotationsMethod that displays all the annotations hidden by the user.
ShowHiddenCurvesMethod that displays all the curves explicitly hidden by the user.

Properties

NameDescription
ActiveDesignViewRepresentationProperty that returns the name of the active Design View Representation for a drawing view of an assembly. This property returns a null string for drawing views of parts and presentations and in the case where the model (assembly) is unresolved.
ActiveLevelOfDetailRepresentationProperty that returns the name of the active Level of Detail Representation for a drawing view of an assembly. This property returns a null string for drawing views of parts and presentations and in the case where the model (assembly) is unresolved.
ActiveMemberNameProperty that gets and sets the name of the active member for a drawing view of an iPart or an iAssembly.
ActivePositionalRepresentationProperty that gets and sets the name of the active Positional Representation for a drawing view of an assembly. This property returns a null string and cannot be set for drawing views of parts and presentations and in the case where the model (assembly) is unresolved.
ActivePresentationViewProperty that returns the name of the active Presentation (Exploded) View for a drawing view of a presentation.
AlignedProperty that gets and sets whether the view is aligned with another view. This property can only be set to False in order to break the alignment. To align the view, use the Align method.
AttributeSetsProperty that returns the AttributeSets collection object associated with this object.
AuxiliaryOrientationEdgeProperty that returns drawing curve that the auxiliary view is aligned to. This property returns Nothing if this is not an auxiliary view or if the orientation edge (drawing curve) has been removed from the parent view during a subsequent update.
BitmapAvailableProperty that returns if this view's graphics are also available as a bitmap as well. If a bitmap exists it can be retrieved using the DataIO object. This is only applicable within Apprentice.
BreakOperationsProperty that returns the BreakOperations object containing information about all the break operations applied to this view as well as methods to add breaks. Both local as well as inherited break operations are returned in the collection.
BreakOutOperationsProperty that returns the BreakOutOperations object containing information about all the break out operations applied to this view as well as methods to add break outs. Only local break out operations are returned.
CameraProperty that returns a Camera object that defines the orientation of the model within the view.
CenterGets and sets the display center point of the drawing view on the owning sheet.
ClientGraphicsCollectionProperty that returns the ClientGraphicsCollection object.
DataIOProperty that returns the associated DataIO object. This can be used in Apprentice to obtain an associated bitmap, if it exists.
DisplayBendExtentsProperty that gets and sets whether to display sheet metal bend extents on the drawing view.
DisplayDefinitionInBaseProperty that gets and sets whether to display detail circles, section lines and the associated text in the base view. The property returns False and cannot be set where not applicable.
DisplayForeshortenedTangentEdgesProperty that gets and sets whether to display shortened tangent edges in order to distinguish them from visible edges. Setting this property to True automatically toggles the DisplayTangentEdges property to True.
DisplayHatchingProperty that gets and sets whether to display hatches for section and slice views.
DisplayInterferenceEdgesProperty that gets and sets whether to display both hidden edges that are excluded due to an interference condition (press, or interference fit conditions, threaded fasteners in tapped holes where the hole feature is modeled with the minor diameter).
DisplayTangentEdgesProperty that gets and sets whether to display the tangent edges on the drawing view. Setting this property to False automatically toggles the DisplayForeshortenedTangentEdges property to False.
DisplayThreadFeaturesProperty that gets and sets whether to display thread features on the drawing view.
DisplayTrailsProperty that gets and sets whether to display trails. The property returns False and setting it fails if the drawing view does not reference a presentation document.
DrawingCurvesProperty that returns all the drawing curves within the drawing view optionally filtered to the input model object. This property returns Nothing for draft views.iew object represents a drawing view on a sheet.
DrawingViewEventsProperty that returns the object, which provides event notifcation. For example, view updates.
DrawingViewToModelTransformProperty that returns the transformation from drawing view coordinate space to the model space.
DrawingViewToSheetTransformProperty that returns the transformation from drawing view coordinate space to the sheet space.
GeneralDimensionTypeProperty that indicates the type of dimension.
GraphicsDataSetsCollectionProperty that returns the object for the drawing view.
HasOriginIndicatorProperty that specifies whether the origin indicator for ordinate dimensions and hole tables has been created.
HeightProperty that specifies the height of the drawing view. The view height cannot be set but is defined by the contents of the view
InheritBreakProperty that gets and sets whether the view should inherit the corresponding break from the parent view. Setting this property is only possible for certain views. Orthographic projected views inherit breaks by default, which can be turned off.
InheritBreakOutProperty that gets and sets whether the view should inherit the corresponding break out from the parent view. Setting this property is only possible for certain views. Isometric projected views created for views with a break out inherit the break out by default. Orthographic projected and auxiliary views do not support inheritance of break out operations.
InheritSectionProperty that gets and sets whether the view should inherit the corresponding section cut from the parent view. Setting this property is only possible for certain views. Isometric projected views created for section views inherit the section cut by default. Orthographic projected and auxiliary views support the inheritance of the section, but it is switched off by default.
InheritSliceProperty that gets and sets whether the view should inherit the corresponding slice cut from the parent view. Setting this property is only possible for certain views.
IsFlatPatternViewGets whether the drawing view is of a sheet metal flat pattern.
IsRasterViewRead-write property that gets and sets whether the drawing view is raster view or not.
IsUpdateCompleteIndicates if the view has finished updating.
LabelProperty that returns the DrawingViewLabel object.
LeftProperty that returns the position of the left edge of the drawing view.
ModelToDrawingViewTransformProperty that returns the transformation from model space to the drawing view coordinate space.
ModelToSheetTransformProperty that returns the transformation from model space to the sheet coordinate space.
NameProperty that gets and sets the name of the DrawingView. This is the editable portion of the name that is displayed within the browser. Inventor appends some additional information to the displayed name. When setting the name, the name must be unique with respect to all other DrawingView objects in the sheet, or an error will occur.
OriginIndicatorProperty that gets the origin indicator for ordinate dimensions and hole tables.
ParentProperty returning the parent Sheet object.
ParentViewProperty that returns the parent . This property returns Nothing in the case where no parent view exists.
PositionGets and sets the point used to position the drawing view on the sheet.
PresentationViewAssociativeProperty that gets and sets whether to associate the drawing view to the referenced presentation view. The property always returns False for drawing views of parts and assemblies and setting the property returns an error in this case. Use the ActivePresentationView property to get the referenced presentation view.
ReferencedDocumentDescriptorProperty that returns the model document referenced by this view.
RotationProperty that gets and sets the absolute rotation angle of the drawing view in radians. The value can either be positive (counter-clockwise rotation) or negative (clockwise rotation).
ScaleProperty that gets and sets the model to paper space scale of the view. Setting this property will fail if the ScaleFromBase property returns True.
ScaleFromBaseProperty that gets and sets whether the scale of the view derives from the parent view or not. This property fails for base drawing views.
ScaleStringProperty that gets and sets the scale in string format. For instance, '2', '5:1' and '1 / 2' are valid values. The Scale property returns the value of this scale as a double value. Setting this property will fail if the ScaleFromBase property returns True.
SheetToDrawingViewTransformProperty that returns the transformation from sheet space to the drawing view coordinate space.
SheetToModelTransformProperty that returns the transformation from sheet coordinate space to the model space.
ShowLabelProperty that gets and sets whether to show the label of the drawing view on the sheet.
SketchesProperty that returns the DrawingSketches collection object for the sheet. This object provides access to all of the sketches that have been created on the sheet and provides functionality to create new sketches.
StandardPartsSectionBehaviorProperty that gets and sets the sectioning behavior for standard parts in drawing views of assemblies.
SuppressedProperty that gets and sets whether the drawing view is suppressed (invisible).
TopProperty that specifies the position of the top edge of the drawing view.
TypeReturns an ObjectTypeEnum indicating this object's type.
UpToDateProperty that returns whether the drawing view is up to date with respect to the model.
ViewJustificationProperty that gets and sets the view justification. Valid values are kCenteredViewJustification and kFixedViewJustification.
ViewOrientationFromBaseGets and sets whether the view should inherit the orientation from the base view.
ViewStyleProperty that gets and sets the drawing view style. Valid values are kHiddenLineDrawingViewStyle, kHiddenLineRemovedDrawingViewStyle, kShadedDrawingViewStyle, kShadedHiddenLineDrawingViewStyle and kFromBaseDrawingViewStyle.
ViewTypeProperty returning an DrawingViewTypeEnum constant indicating the type of view.
WidthProperty that specifies the width of the drawing view. The view width cannot be set but is defined by the contents of the view.


Greetings

 



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
670 Views
3 Replies
Replies (3)
Message 2 of 4

AlexFielder
Advisor
Advisor
It looks like you've hit the nail on the head; there is no DrawingView.Export(filename as string) function in the list of methods.
I suppose it's technically possible to add an extension method to do just that, but what you suggested about copying the view to a new drawing sheet sounds like the easiest option - it is what you do manually after all.
0 Likes
Message 3 of 4

Jef_E
Collaborator
Collaborator

Hi @AlexFielder

 

I thought so, maybe there was a simple solution in the. Model to sheet space etc. But that just above my paygrade 😉 Still gonna see if someone with more experience knows a solution.

 

I don't mind to learn.



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 4 of 4

j.brodersen
Enthusiast
Enthusiast

Hi Jef,

 

don't know if you're still looking for a solution to get only one view on the drawing exported!?

 

Just had the same Problem just with the Export of DXF files where I only want the base view as dxf and came up with following rule which did the Job so far

Sub Main

Dim baseView As DrawingView = Nothing
For Each view As DrawingView In ActiveSheet.Sheet.DrawingViews
  If (view.ParentView Is Nothing) Then
	baseView = view
	Exit For
  End If
Next



'Get all views on drw
Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument

oSheet = oDrawingDoc.ActiveSheet

	oViews = oSheet.DrawingViews
	Dim oView As DrawingView
	
'Excludes the View I need and suppresses all others	
For Each oView In oViews
If oView Is baseView Then
Else
ActiveSheet.View(oView.Name).View.Suppressed = True
End If	
Next


'Sets the Folderlocation and does the export to DXF
oFolder = ThisDoc.Path+"\"
doc = ThisDoc.Document
doc.SaveAs(oFolder+"\"  + "" + (".dxf"), True)

'Unsupresses the previuos suppressed views
For Each oView In oViews
If oView Is baseView Then
Else
ActiveSheet.View(oView.Name).View.Suppressed = False
End If	
Next
MessageBox.Show("Everything's visible again and Export is done")
End Sub

Hope that it's what you are looking for or that it give you a Little help