Tagged: macro RSS

  • BReilly 2:05 pm on March 17, 2009 Permalink | Log in to leave a Comment
    Tags: API, Face, macro, Selection   

    Is there a way to select a face of a BodyFeature by name in a macro (VB)? I renamed the face of a weldment part a name I can remember, but I do not know the tag to use in VB to select it. Here is the peice of code I need help with

    Part.Extension.SelectByID2(<>, “FACE”, 0, 0, 0, False, 0, Nothing, 0)

     
    • admin 6:12 pm on March 17, 2009 Permalink

      From twitter:

      If you used tags to name the face, you can search. In the search/filter tab type the face name and it will filter to the body.

      Thanks @Alignex

    • BReilly 6:35 pm on March 17, 2009 Permalink

      Thnk you, but how can I use TAGS to select items in a macro? I don’t need to find the part, I need to automate selection of a face for a measure command in a macro. Measure and Closest.Distance both will not take BodyFeatures, so I need to call a face by ID.

  • Jason Corl 11:39 am on December 4, 2008 Permalink | Log in to leave a Comment
    Tags: macro   

    I’m looking for a macro that will rename primary planes (to specified names) and set planes to auto-size. Does anyone have or know of a macro that will do this?

    Thanks
    Jason

     
    • admin 11:45 am on December 4, 2008 Permalink

      I don’t know of a macro like this Jason great idea! Also have you seen this link http://solidjott.com/?p=79#comments, would you be able to help this guy?

    • CBL 2:18 pm on December 4, 2008 Permalink

      The following is just a recording of keystrokes (yes it actually worked) using SW2009-SP1.
      The macro can be edited to change the planes existing and wanted names.

      I have no idea how to do the ‘autosize’ though. The plane is autosized by default, and can only be reset to autosize after it has been manually changed.


      ' ******************************************************************************
      ' C:\DOCUME~1\Kelvin\LOCALS~1\Temp\swx3112\Macro1.swb - macro recorded on 12/04/08 by Kelvin
      ' ******************************************************************************
      Dim swApp As Object

      Dim Part As Object
      Dim boolstatus As Boolean
      Dim longstatus As Long, longwarnings As Long

      Sub main()

      Set swApp = Application.SldWorks

      Set Part = swApp.ActiveDoc
      boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "Plane 1")
      boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Top Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "Plane 2")
      boolstatus = Part.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      Part.ClearSelection2 True
      boolstatus = Part.Extension.SelectByID2("Right Plane", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
      boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "Plane 3")
      End Sub

    • Alan 4:50 pm on December 4, 2008 Permalink

      You can change the names and save them in your templates, or save a template with each set of names if you have multiples.

    • Chris Serran 5:04 pm on December 4, 2008 Permalink

      Good point Alan, however I’m going to guess he wants to change the names of planes in some existing parts.

    • JeffM 10:50 am on December 5, 2008 Permalink

      Planes can be auto-sized by RMB on the plane name in the FM and choosing auto-size. Most useful when working on large sized parts/assemblies or imported large parts. Not sure how to go about automating that.

    • Jason Corl 11:10 am on December 5, 2008 Permalink

      Hey Guys,

      Chris, you are correct, I do know how to create templates for new parts but I am working with many old parts and trying to update them to new standards. I also do know how to auto-size by rmb but I am looking for an automated process.

      CBL…as for the macro, changing the names of existing to desired, the planes are named differently in almost every model/assy….different order of names. I need it to use the SW terminology/syntax that identifies the “default” planes in the assembly by their programming names. Standard naming for reference planes is Front, Top, Right. We have drawings that are named…BL, FS, WL…or WL, BL, FS, or ….etc. I want to change these to Front (FS), Top (WL), Right (BL). Can this macro do that? For those of you that are wondering, I believe the FS, WL, and BL naming come from aero..boeing coordinate system I believe…FS=Fuselage Station, WL=Water Line (not good for a plane), BL=Buttress Line.

      Someone else suggested to use part of an example from the API help in SW but I am no programmer and don’t know where to start. I want to learn but just haven’t had the time to dive in yet.

      I’ll keep asking around and see if I come up with anything I’ll let you know.

      Thanks,

      Jason

  • tleedz 1:23 pm on December 3, 2008 Permalink | Log in to leave a Comment
    Tags: macro   

    I was wondering if there is a way to create an icon for the macros that I use daily?

     
    • admin 1:29 pm on December 3, 2008 Permalink

      You can choose the icon you want. You can make them with any graphic editor you choose. Just save as a bitmap and go and edit the file to have the .ICO suffix name, keep in mind the size of the icon I belive you need it to be 16 x 16 pixels. You can use Irfanview to scale-save or convert any picture to an icon

      http://www.irfanview.com/

    • Jason Corl 11:56 am on December 4, 2008 Permalink

      You can try this program for making icons…
      http://toycon.en.softonic.com/

      There are several free “icon” programs out there including IcoFX (http://icofx.ro/index.html)

      I’m not sure if these will work for making SW macro icons as I have never done this.

      Another option is to check out AngelSix’s SWTools program here: http://angelsix.com/2008/10/21/swtools/

      Hope this helps!

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel