Why would you want to run this as a button on the data card and not as say an EPDM task? Also, during the process, are you checking out and back in the file?
When user creates the model in SolidWorks he/she inputs all data whenever sees fit. One field on the card is "Dimensions" where we want the dimensions of the Preform (there is also a list of different preforms).
We have a small addin (if you will) for SolidWorks to pick dimensions from model and write them to models Custom properties -> ends up on the "dimension" field on the data card. I would like to add button next to the dimension field that would close the card, open the dimension linking tool and once dimensions are linked, the card would pop up again.
I see this as a quite natural workflow. we would not need to use the extra button on SolidWorks to startup the dimension linking and then check the datacard, that all is OK...
Arto, sounds like you are unable to map the variable to a SolidWorks custom property because the variable changes on every model.
Sounds to me like you need a stand-alone Windows Form application that can open the SW document structure without "opening" the document, list all available dimension names & their values, then when the user selects one update the datacard variable with the dimension value. Sounds easy enough.
Have your programmer reference the SolidWorks document manager API. Its free but you will need a serial number from SolidWorks to use it which usually gets turned around in a couple days. They're very responsive. You can hook the SW document and its properties without "opening" SW which means updating the datacard in EPDM is done without the file being read only.
Sorry, it seems I'm making a quite mess with a simple question.
Our tools works so that user picks dimensions from model, these then form the Preform Dimension "Plate 2mm 500x250" and all of this works like it should (writing the custom properties, with dimension links and PDM card reading the properties).
My only problem is starting the tool from SolidWorks from PDM Datacard. if I run for example exe from button, from datacard, the datacard stays active, denying access to SolidWorks screen.
I just need info is it possible, to close the DataCard when the button is pressed.... and when user hits Save from our dimension linkin tool, it would rewoke the datacard of active model (this part should be easier)...
No problem Arto, you haven't made a mess. I understood what you are trying to do.
The problem is I am unable to see a way to get you there due to API limitations on the EdmCmd_CardButton or EdmCmd_CardInput events. These are events that are fired when the user presses a datacard button or modifies a card variable (i.e. entering 1 character in a text field, changing a pull down list value, selecting a radio button).
If an addin is hooking the card button event or card input event, when the user presses the button or modifies a card variable field, the addin is called and supplied with parameters that provide parameters like the FileID, FolderID, active configuration, pathname, etc. of the file the action was taken on, PLUS the datacard interface is still being displayed (persisting).
Any code that gets executed on a card button/input event is done so while the card interface is displaying (persisting...locked so to speak). That is the reason for the error message about the card denying access to SolidWorks and the active model. The card interface is only released after the program terminates abnormally OR when the program is finished running.
That also inadvertently makes it challenging to design an event on a card button that will check in a file "after" modifying the card variables because the card interface is still persisting. Saving and dismissing the card is not a problem either.
The addin can be programmed to "pass back" a modified array of values to tell the EPDM interface to save the card inputs (automated way of pressing the OK/save/apply button on the card) BUT this only gets evaluated AFTER the addin is done running. This is done by modifying the poCmd structure and having your program return it.
I could be wrong but am unable to see a potential solution since you are calling another 3rd party add-in from a card and modifying the card.
As verification, today I put together a couple addins to mimic what you are doing.
- Opening SW using a stand alone app, no problem.
- Hooking a datacard button and modifying card variables, no problem.
- Adding both together, not possible from what I can see.
That's why I recommended a stand alone application that would use the SW doc mgr API and pull in the dimensions, grab the value, and stuff it into the datacard, and save the data card.
Let me know if this helps or if I have actually misunderstood your meaning.