custom properties

Discussion in 'SolidWorks' started by Bates, Nigel, Jun 7, 2004.

  1. Bates, Nigel

    Bates, Nigel Guest

    Using VB is there a way of accessing custom properties of a selected
    'object' in an assembly rather than having to open this part/ assembly
    and then using 'ActiveDocument' type access?
    cheers
    nigel
     
    Bates, Nigel, Jun 7, 2004
    #1
  2. Dim CompDocument as SldWorks.ModelDoc2
    Dim Component As SldWorks.Component2
    ...........
    set CompDocument = Component.GetModelDoc

    This should get you started

    Corey
     
    Corey Scheich, Jun 7, 2004
    #2
  3. Sure... Here's a bit of code that will allow you to access the model
    object without opening the part.

    Dim ActiveModel, Assy, Component, SelMgr as Object
    Dim CurrentConfig as String

    ' Get object for assembly
    Set Assy = swApp.ActiveDoc
    ' Get the selection manager class
    Set SelMgr = Assy.SelectionManager()
    ' Retrieve selected object
    Set Component = SelMgr.GetSelectedObject3(1)
    ' Get object for selected component
    Set ActiveModel = Component.GetModelDoc
    ' Get the referenced configuration
    CurrentConfig = Component.ReferencedConfiguration

    A product of ours, Custom Property Manager, accesses custom properties
    from the assembly without opening the part. It also can put all the
    properties for all parts in a list with PropLister. This makes it
    easy to compare properties amongst parts and to check if anything is
    missing. Parts can be edited by clicking any row in the list.

    www.KentContract.com/swmacros.shtml

    Kent
     
    KCS Development, Jun 7, 2004
    #3
  4. Bates, Nigel

    rocheey Guest

    Using VB is there a way of accessing custom properties of a selected
    Yes.... technically. If the Assembly is loaded, then the models may be
    loaded anyway (unless the assembly is lightweight). You need a
    reference to the loaded modeldoc to get the Model custom properties
    thru the API, but you dont necessarily have to have the model SHOWING.
    If you have the assembly showing,
    get the COMPONENT object of the assembly, and then use GETMODELDOC of
    the component. From there you can get the custom/config specific
    properties.
     
    rocheey, Jun 7, 2004
    #4
  5. Bates, Nigel

    Bates, Nigel Guest

    many thanks all, sorted, very usefull extra piece of knowledge!!

    -----Original Message-----
    From: Corey Scheich [mailto:]
    Posted At: 07 June 2004 14:29
    Posted To: solidworks
    Conversation: custom properties
    Subject: Re: custom properties


    Dim CompDocument as SldWorks.ModelDoc2
    Dim Component As SldWorks.Component2
    ...........
    set CompDocument = Component.GetModelDoc

    This should get you started

    Corey
     
    Bates, Nigel, Jun 7, 2004
    #5
  6. The best property propagator I've seen is Propa-Gator,
    www.CustomSolids.com by Brenda Bosley. Propa-Gator also propagates
    material density, summary info, and drawing templates. For global
    operations, I definitely recommend this one.
     
    KCS Development, Jun 8, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.