access solidworks thro vb.net

Jun 07, 2008 2 Replies

hi all..i'm new to use solidwworks and vb.net.i've found the solution t connect solidworks with vb.net.now what i need is..how to read dimension and coordinate points of a part?...can anyone please help me.



Thanks in advance.


-

Message posted using

formatting link
information at
formatting link


hai, i've found the answer..here is the code Dim swApp As SldWorks.SldWorks Dim part As SldWorks.PartDoc Dim swModel As SldWorks.ModelDoc2 Dim swDispDim As SldWorks.DisplayDimension Dim swDim As SldWorks.Dimension Dim swAnn As SldWorks.Annotation Dim feat As SldWorks.Feature swApp = CreateObject("SldWorks.Application")

With swApp .Visible = True .UserControl = True End With MsgBox("connection established")

'open a part document part = swApp.OpenDoc("C:\Documents an Settings\Solidworks\ref.sldprt", 1) part = swApp.ActiveDoc MsgBox("part doc opened")

swModel = swApp.ActiveDoc feat = swModel.FirstFeature

swDispDim = feat.GetFirstDisplayDimension

Do While Not swDispDim Is Nothing

swAnn = swDispDim.GetAnnotation swDim = swDispDim.GetDimension

MsgBox(" DimFullName = " & swDim.FullName) MsgBox(" DimName = " & swDim.Name) 'MsgBox(" DrivenState = " & swDim.DrivenState) 'MsgBox(" ReadOnly = " & swDim.ReadOnly) MsgBox(" Value = " & swDim.GetSystemValue2("" & "m") 'MsgBox(" Arrowside = " & swDispDim.ArrowSide)

Select Case swDispDim.GetType Case 2 MsgBox("linear dimension") Case 5 MsgBox("radial dimension") End Select swDispDim = feat.GetNextDisplayDimension(swDispDim)

Loop

thanks to al

-

Message posted using

formatting link
information at
formatting link

Glad to see you found your answer.

The best SW API help I've found is on the SW web site form.solidworks.com. There are other discussion boards, but that one seems most responsive to API issues.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required