Set Text in Datum Tags and GTols Example (VB.NET)
This example shows how to set the text in datum tags and geometric
tolerances.
'----------------------------------------------------------------------------
' Preconditions: Open a drawing that contains one view, a datum feature,
' and a geometric tolerance.
'
' Postconditions: Each annotation is appended with the specified text.
'
---------------------------------------------------------------------------
Imports
SolidWorks.Interop.sldworks
Imports
SolidWorks.Interop.swconst
Imports
System
Partial
Class
SolidWorksMacro
Dim
swModel As
ModelDoc2
Dim
swModelView As
ModelView
Dim
swDraw As
DrawingDoc
Dim
swView As
View
Dim
swDispGtol As
Gtol
Dim
swDatumTag As
DatumTag
Dim
rect() As
Double
Sub
main()
swModel = swApp.ActiveDoc
swModelView = swModel.ActiveView
swDraw = swModel
swView = swDraw.GetFirstView
'sheet
swView = swView.GetNextView
swDispGtol = swView.GetFirstGTOL
swDispGtol.SetText(swGTolTextParts_e.swGTolTextPrefix,
"prefix")
swDispGtol.SetText(swGTolTextParts_e.swGTolTextSuffix,
"suffix")
swDispGtol.SetText(swGTolTextParts_e.swGTolTextCalloutAbove,
"above")
swDispGtol.SetText(swGTolTextParts_e.swGTolTextCalloutBelow,
"below")
swDatumTag = swView.GetFirstDatumTag
swDatumTag.SetText(swDatumTagTextParts_e.swDatumTagTextPrefix,
"prefix")
swDatumTag.SetText(swDatumTagTextParts_e.swDatumTagTextSuffix,
"suffix")
swDatumTag.SetText(swDatumTagTextParts_e.swDatumTagTextCalloutAbove,
"above")
swDatumTag.SetText(swDatumTagTextParts_e.swDatumTagTextCalloutBelow,
"below")
rect = Nothing
swModelView.GraphicsRedraw(rect)
End
Sub
Public
swApp As
SldWorks
End
Class