1 Reply Latest reply on Aug 23, 2013 11:06 PM by Keith Rice

    Collecting configuration specific informations of a part, from the drawing

    Maxime Ganhy

      Hi everybody.

       

      It's my first time working with macro, and here is a problem I can't solve by myself actually.

       

      I created an assembly, which contain a design table with a lot of different configurations. In this design table, I have a specific name for each configuration.

      I have to make a drawing for each configuration, and saving them under the configuration name, followed by their specific name.

       

      I already did a macro which save each configuration under his configuration name, with a BOM linked to this configuration (based on different macros I've found here). But I don't know how to access the configuration specific information of the assembly directly from the drawing.

       

      Maybe on of this topics could be helpfull, but I've already tried differents things and nothing works.

      https://forum.solidworks.com/message/293115#293115

      https://forum.solidworks.com/message/363823#363823

      https://forum.solidworks.com/message/365710#365710

       

      If needed, I can post my actual code.

       

      Thank.

        • Re: Collecting configuration specific informations of a part, from the drawing
          Keith Rice

          Maxime,

           

          It is hard to tell exactly what you need, but it sounds like you want to access the configuration specific custom properties of a component referenced in a drawing. Is that correct?

           

          Assuming it is, you could something like this for a selected drawing view:

           

          1. Get the root component using IVIew::RootDrawingComponent

          2. Get the IComponent2 pointer using IDrawingComponent::Component

          3. Get the component's underlying IModelDoc2 pointer using IComponent2::GetModelDoc2

          4. Get the custom property manager for the model using IModelDocExtension::CustomPropertyManager. You specify whether you want the documental-level custom properites (the Custom tab) or the configuration specific custom properties via the argument in this method. So for example, if you had a configuration called "Short" you would get its custom props like this:

           

          Dim swCustPropMgr as SldWorks.CustomPropertyManager

          Set swCustPropMgr = swModel.Extension.CustomPropertyManager("Short")

           

          5. You can traverse all of the custom properties in a configuration using ICustomPropertyManager::GetAll.

           

          Hope this helps.

           

          Keith

          Learn SolidWorks API