create base view - idw

create base view - idw

Anonymous
Not applicable
472 Views
5 Replies
Message 1 of 6

create base view - idw

Anonymous
Not applicable
is it possible to create base views using vba, and then can you create views
off of that view?

i didnt find any samples in the help file that delt with views at all.

thanks

Matt
0 Likes
473 Views
5 Replies
Replies (5)
Message 1 of 6

Anonymous
Not applicable
Matt,

Here is some VB code that will create a drawing, then add views to that drawing.

Private Sub cmdCreateDWGSheet_Click()

If oApp.ActiveDocument Is Nothing Then
MsgBox "The active document must be a 'part' document"
Exit Sub
End If

If oApp.ActiveDocument.DocumentType <> kPartDocumentObject Then
MsgBox "The active document must be a 'part' document"
Exit Sub
End If

Dim oPartDoc As PartDocument
Set oPartDoc = oApp.ActiveDocument

Dim oDrawingDoc As DrawingDocument
Set oDrawingDoc = oApp.Documents.Add(kDrawingDocumentObject, oApp.FileManager.GetTemplateFile(kDrawingDocumentObject))


Dim VScale As Double
VScale = 0.11

Dim lHoriz As Long
lHoriz = 10
Dim lVert As Long
lVert = 15

Dim oDrawingViews As DrawingViews
Dim oDV As DrawingView
Set oDrawingViews = oDrawingDoc.Sheets(1).DrawingViews

Dim V_Org As Point2d
Set V_Org = oApp.TransientGeometry.CreatePoint2d(lHoriz, lVert)
Set oDV = oDrawingViews.AddBaseView(oPartDoc, V_Org, VScale, kLeftViewOrientation, _
kHiddenLineRemovedDrawingViewStyle)

Set V_Org = oApp.TransientGeometry.CreatePoint2d(lHoriz + 20, lVert)
Set oDV = oDrawingViews.AddBaseView(oPartDoc, V_Org, VScale, kFrontViewOrientation, _
kHiddenLineRemovedDrawingViewStyle)

Set V_Org = oApp.TransientGeometry.CreatePoint2d(lHoriz, lVert + 18)

Call oDrawingViews.AddProjectedView(oDV, V_Org, kIsoTopLeftViewOrientation, _
kHiddenLineRemovedDrawingViewStyle, VScale)


End Sub
0 Likes
Message 3 of 6

Anonymous
Not applicable
thanks alot  🙂

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Matt,

Here is some VB code that will create a drawing, then add views to that
drawing.

Private Sub cmdCreateDWGSheet_Click()

If oApp.ActiveDocument Is Nothing Then

        MsgBox "The active
document must be a 'part' document"

        Exit Sub

    End If

If oApp.ActiveDocument.DocumentType <> kPartDocumentObject Then

        MsgBox "The active
document must be a 'part' document"

        Exit Sub

    End If

Dim oPartDoc As PartDocument
    Set oPartDoc =
oApp.ActiveDocument

Dim oDrawingDoc As DrawingDocument
    Set
oDrawingDoc = oApp.Documents.Add(kDrawingDocumentObject,
oApp.FileManager.GetTemplateFile(kDrawingDocumentObject))


Dim VScale As Double
    VScale = 0.11

Dim lHoriz As Long
    lHoriz = 10

    Dim lVert As Long

    lVert = 15

Dim oDrawingViews As DrawingViews
    Dim oDV As
DrawingView
    Set oDrawingViews =
oDrawingDoc.Sheets(1).DrawingViews

Dim V_Org As Point2d
    Set V_Org =
oApp.TransientGeometry.CreatePoint2d(lHoriz, lVert)

    Set oDV = oDrawingViews.AddBaseView(oPartDoc,
V_Org, VScale, kLeftViewOrientation, _

                kHiddenLineRemovedDrawingViewStyle)

Set V_Org = oApp.TransientGeometry.CreatePoint2d(lHoriz + 20, lVert)

    Set oDV = oDrawingViews.AddBaseView(oPartDoc,
V_Org, VScale, kFrontViewOrientation, _

                kHiddenLineRemovedDrawingViewStyle)

Set V_Org = oApp.TransientGeometry.CreatePoint2d(lHoriz, lVert + 18)

Call oDrawingViews.AddProjectedView(oDV, V_Org, kIsoTopLeftViewOrientation,
_

                kHiddenLineRemovedDrawingViewStyle,
VScale)


End Sub

0 Likes
Message 4 of 6

Anonymous
Not applicable
clu82,
I really like this code and I'm trying to do the same as the other user. We only create individual part drawings that require machining. A Plan, Top, Side and 2 Iso views. We do this manual. I tried this code the way it is and I keep bombing at the"AddProjectedView" line. (even other posts w/ "AddProjectedView" I can not get by this one line. Whats wrong here? I have inv11 w/sp3. Thanks in advance. Tim
0 Likes
Message 5 of 6

Anonymous
Not applicable
The macro is using an older (obsolete) signature for AddProjectedView. The
new signature has one argument less (the view orientation is gone). this
should work:

Call oDrawingViews.AddProjectedView(oDV, V_Org, _
kHiddenLineRemovedDrawingViewStyle, VScale)

Sanjay-

wrote in message news:5739570@discussion.autodesk.com...
clu82,
I really like this code and I'm trying to do the same as the other user. We
only create individual part drawings that require machining. A Plan, Top,
Side and 2 Iso views. We do this manual. I tried this code the way it is and
I keep bombing at the"AddProjectedView" line. (even other posts w/
"AddProjectedView" I can not get by this one line. Whats wrong here? I have
inv11 w/sp3. Thanks in advance. Tim
0 Likes
Message 6 of 6

Anonymous
Not applicable
This correction gets me on my way. Thank you.
0 Likes