Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API inset hole table

Status
Not open for further replies.

Bwaggoner

Mechanical
Apr 9, 2007
23
I've written a macro that insterts a hole table as part of a bigger program that I'm working on.
The issue is I want to hide the table after it is inserted but have the origin shown.
I can't seem to find the code to do that.
Below is the code to insert the table any help would be appreciated.
Code:
Sub test_table()
Dim swapp As SldWorks.SldWorks
Dim swView As SldWorks.View
Dim swmodel As SldWorks.ModelDoc2
Dim swselmgr As SldWorks.SelectionMgr
Dim swHoleTable As SldWorks.HoleTableAnnotation
    Set swapp = CreateObject("SldWorks.Application")
    Set swmodel = swapp.ActiveDoc
    Set swselmgr = swmodel.SelectionManager
    Set swView = swselmgr.GetSelectedObjectsDrawingView(1)
    Set swHoleTable = swView.InsertHoleTable(0, 0.036051, 0.082461, 1, "C:\SolidWorks2008\SolidWorks\lang\english\standard hole table--numbers.sldholtbt")
End Sub
 
Replies continue below

Recommended for you

After your "Set swHoleTable =..." line, you need:

Code:
Dim swDatumOrigin as SldWorks.DatumOrigin
Set swDatumOrigin = swHoleTable.HoleTable.DatumOrigin
swHoleTable.GetAnnotation.Visible = swAnnotationHidden
swDatumOrigin.GetAnnotation.Visible = swAnnotationVisible



-handleman, CSWP (The new, easy test)
 
Handleman you are a lifesaver.

It works great thanks.
 
Code:
Set swHoleTable = swView.InsertHoleTable(0, 0.036051, 0.082461, 1,(snip)

Is this line setting the insertion point for the table? Does the table template need to have the "attach to anchor toggled off? Just curious.

Joe
SW Office 2008 SP3.1
P4 3.0Ghz 3GB
ATI FireGL X1
 
Yes that inserts the hole table.
It doesn't have to but I don't have a anchor point set so I would rather let the user position it wherever they need it to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor