SW Addin : Sketch Census
SW Addin : Sketch Census
(OP)
Hello everyone,
Right now, i'm using VB.net 2010 and Solidworks 2011 to make SW VB addin that needs the number of lines used in a part.
I did some research about this problem and found an addin in <http://www.esoxrepublic.com/freeware/> called Madmango's sketch census tool and it looks like created into an addin by Thetick. The addin works fine, but i need the code to get the number in a sketch into a variable. I've tried to decompile the .dll file but no results. Maybe someone can help me decompile that file into vb.net or help me with the macro to acquire the number of lines used in a sketch.
Maybe Thetick or Madmango could help me, please?
thanks in advance,
Right now, i'm using VB.net 2010 and Solidworks 2011 to make SW VB addin that needs the number of lines used in a part.
I did some research about this problem and found an addin in <http://www.esoxrepublic.com/freeware/> called Madmango's sketch census tool and it looks like created into an addin by Thetick. The addin works fine, but i need the code to get the number in a sketch into a variable. I've tried to decompile the .dll file but no results. Maybe someone can help me decompile that file into vb.net or help me with the macro to acquire the number of lines used in a sketch.
Maybe Thetick or Madmango could help me, please?
thanks in advance,






RE: SW Addin : Sketch Census
http://eng-tips.com/viewthread.cfm?qid=107220
-handleman, CSWP (The new, easy test)
RE: SW Addin : Sketch Census
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: SW Addin : Sketch Census
@Thetick: it's okay, Handleman got the link to the original thread. All i need is the macro for counting sketch elements. Thanks for your concern.
RE: SW Addin : Sketch Census
CODE -->
Option Explicit Public Enum swSkSegments_e swSketchLINE = 0 swSketchARC = 1 swSketchELLIPSE = 2 swSketchSPLINE = 3 swSketchTEXT = 4 swSketchPARABOLA = 5 End Enum Dim Total As Integer Sub main() Dim sSkSegmentsName(5) As String Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swSelMgr As SldWorks.SelectionMgr Dim swFeat As SldWorks.feature Dim swSketch As SldWorks.sketch Dim vSkSegArr As Variant Dim vSkSeg As Variant Dim swSkSeg As SldWorks.SketchSegment Dim swSkLine As SldWorks.SketchLine Dim swSkArc As SldWorks.SketchArc Dim swSkEllipse As SldWorks.SketchEllipse Dim swSkSpline As SldWorks.SketchSpline Dim swSkText As SldWorks.SketchText Dim swSkParabola As SldWorks.SketchParabola Dim vID As Variant Dim i As Long Dim bRet As Boolean Total = 0 On Error GoTo huboalgo Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swSelMgr = swModel.SelectionManager Set swFeat = swSelMgr.GetSelectedObject4(1) Set swSketch = swFeat.GetSpecificFeature vSkSegArr = swSketch.GetSketchSegments For Each vSkSeg In vSkSegArr Set swSkSeg = vSkSeg Total = Total + 1 Next vSkSeg MsgBox "Total of segments: " & Total, vbInformation, "SEGMENTS COUNT" GoTo THEEND huboalgo: MsgBox "Please select an sketch", vbCritical, "MACRO ERROR" THEEND: End Subi understand that the highlighted code is the code for counting the segments in a sketch but i wonder how to separate the lines, arcs, and parabolas in different variable.
and i still don't understand the purpose of some variables like swskline, swskarc, swskellpise, and so on.
can somebody help me?
thanks
RE: SW Addin : Sketch Census
-handleman, CSWP (The new, easy test)
RE: SW Addin : Sketch Census
Regards,
Artem Taturevych
Application Engineer at Intercad
http://intercad.com.au/
Tel: +61 2 9454 4444
RE: SW Addin : Sketch Census
i'll work my way out.