Automatic drawing

Hello, I'm looking to do an "automatic" drawing of my parts, I'm doing predefined drawings, (when I insert my part, the views put themselves) but I can't manage to put the drilling board in automatic mode. How do you do it? Or if this is not possible, is it possible to do it with a macro?

I also looked to do this with  SmartDrawings from myCADtools but it's the same there is no table.


testplan.jpg

Hello

Yes, it is possible by inserting a drilling table,...

I'll show you later because my pc is being processed.

Kind regards.

@+.

AR.

Is it possible to do it in the predefined drawing? because you have to give an origin and a face but as there are no pieces I can't do it.

Okay thank you, I'm waiting for your feedback. 

Hello again,

Here is my explanation of the table to be inserted in the drawing.

Kind regards.

AR.


2020-09-01_135558.jpg
1 Like

Thank you for your answer, but that's not what I'm looking for, I have a hard time expressing myself. I know how to insert a drill table, but I would like it to be automatically put into a typical drawing.

when I'm on my 3D part I have a drawing created from the part, I choose my type of plan, and when I validate, it directly puts me the ISO view , the top view, the auxiliary views, etc.  (Currently that's what I have.)

but in this TYPE model of plan I would also like to integrate the drilling table, which comes to put it directly without me having to do anything, when I do a drawing afterwards.

Hello.

This is possible via macro with the InsertHoleTable2 function

See the examples provided on this page

1 Like

thank you JeromeP I just looked, that's what I need.

Do you have a solution to not have to give the X and Y coordinates for the selection of the top of the coin as well as the face? because depending on the part that is going to be inserted, the coordinates will not be the same and so it doesn't work.

boolstatus = Part.Extension.SelectByID2("", "VERTEX", 0.0443, 0.0674, 0, True, 1, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("", "FACE", 0.067, 0.083, 0, True, 2, Nothing, 0)

It would have to automatically detect a vertex of the coin as well as the face of the automatically inserted coin but I don't see how to do it.

base code used.

Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim spec As SldWorks.DocumentSpecification
Dim Drawing As SldWorks.DrawingDoc
Dim boolstatus As Boolean
Option Explicit
Sub main()
    Set swApp = Application.SldWorks
    Set spec = swApp.GetOpenDocSpec("C:\Program Files\SolidWorks Corp\SOLIDWORKS\samples\tutorial\api\cover_datum.sldprt")
    Set Part = swApp.OpenDoc7(spec)
    Set Drawing = swApp.NewDocument("C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\samples\tutorial\advdrawings\Drawing.drwdot", 2, 0.2794, 0.4318)
    Set Part = Drawing
    boolstatus = Part.Extension.SelectByID2("Sheet1", "SHEET", 0.39237, 0.5218942019544, 0, False, 0, Nothing, 0)
    boolstatus = Part.Create3rdAngleViews2("C:\Program Files\SolidWorks Corp\SOLIDWORKS\samples\tutorial\api\cover_datum.sldprt")
    Part.ClearSelection2 True
    boolstatus = Part.ActivateView("Drawing View1")
    'Select a vertex in the drawing view to be the origin of all datums in the table
    'All XLOC and YLOC table column values will be relative to this datum origin
    boolstatus = Part.Extension.SelectByID2("", "VERTEX", 0.117324728174898, 0.108554228680764, -500.0075, True, 1, Nothing, 0)
    'Select a face that contains the holes that will be annotated in the table
    boolstatus = Part.Extension.SelectByID2("", "FACE", 0.090728339186173, 0.119052803281577, -500.0075, True, 2, Nothing, 0)
    Dim myView As Object
    Set myView = Part.SelectionManager.GetSelectedObjectsDrawingView2(1, -1)
    Dim myHoleTable As Object
    'Insert a hole table
    'anchored with its top left corner at x-coordinate = 0.07m and y-coordinate = 0.175m,
    'with starting datum tag "A",
    'using hole table template: standard hole table--letters.sldholtbt
    Set myHoleTable = myView.InsertHoleTable2(False, 0.153019881817662, -3.77259107537343E-02, 1, "A", "C:\Program Files\SolidWorks Corp\SOLIDWORKS\lang\english\standard hole table--letters.sldholtbt")
    Part.ClearSelection2 True
    boolstatus = Part.ActivateSheet("Sheet1")
End Sub