×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SW Addin : Sketch Census

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,

RE: SW Addin : Sketch Census

I lost track of that source code a long time ago.

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

RE: SW Addin : Sketch Census

(OP)
@Handleman: thanks for the fast response, i haven't tried it yet but i think it will work. i'll write some reports when i've tried it.

@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

(OP)
okay, so i've tried this macro from original thread:

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 Sub 

i 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

Sorry, your original post kind of made it sound like you knew what you were doing and only needed a nudge in the right direction. Unfortunately, your current level of understanding requires more time to teach than I have. Just writing the code for you would be quicker, but I don't have time for that either. Sorry!

-handleman, CSWP (The new, easy test)

RE: SW Addin : Sketch Census

(OP)
okay, thanks for your time.
i'll work my way out.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources