custom properties

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

Reply to
Bates, Nigel
Loading thread data ...

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

This should get you started

Corey

Reply to
Corey Scheich

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.

formatting link

Kent

Reply to
KCS Development

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.

Reply to
rocheey

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

-----Original Message----- From: Corey Scheich [mailto: snipped-for-privacy@garlockequip.com] 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

Reply to
Bates, Nigel

The best property propagator I've seen is Propa-Gator,

formatting link
by Brenda Bosley. Propa-Gator also propagates material density, summary info, and drawing templates. For global operations, I definitely recommend this one.

Reply to
KCS Development

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.