Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Properties 2

Status
Not open for further replies.

b18c5rjdm

Mechanical
Dec 2, 2005
51
Is there a way to force properties before a save? For example, you get a part from someone, not all the prop. are filled out, you go to detail the thing and you titleblock format has about 10 custom fields(description, mass, treatment...) and you have to go back to the model again and fix problems... And if you don't have ownership then that's even more wasted time... Does anyone have any ideas?

Go Honda!
 
Replies continue below

Recommended for you

So again, a week later, has anyone found a solution? Today I have spent 9 hours correcting other people's work....

Go Honda!
 
I am trying to figure out if i can use Visual Basic Express 2k5 to work on an add-in for this. It's slow going since I have more free time than I know what to do with (Denote Sarchasm). Did you have any time this past weekend Tick?

Boottmills [soapbox]
SW2006 SP3.0
 
What about Gildashard's response on 26 Sep 06 22:59?

You could remove the existing "Save" button and replace it with a "Save" that does the same thing but also excutes your code.

You could do the same with the menu entry. Seems like a fairly simple solution.

Ken
 
Hello again,

Just hold on until the weekend is over.

right now I got this AddIn ready to use, but you'll have to configure it manually by editing a xml file with Notepad.
So I will need a lil bit more time to setup up a Admin Tool.

cheers
Michael



 
Here is a macro starter that I wrote for creation of the macro launching addin mentioned earlier. It would allow novice to intermediate macro writers to easily trigger their macros by SolidWorks events.

To use it, put the macro path, module name, and procedure name in the EventAssignments.MDB file in the EventList table for the event you want to trigger the macro. Of course, you will have to tell the macro where the mdb is, either by changing the constant at the top of the form code or by hitting the "Update Path" button on the form itself.

I'm guessing the addin will have to store the data file path in the registry?

Following are some limitations:

1. Running the end-user's macros uses the SldWorks::RunMacro function, which doesn't allow any passing of the arguments generated by the events.
2. Actions (such as saving) can't be cancelled because the user's macro can't return any value to the addin. Cancelling an event-triggered action requires some value to be set in the event's code.
3. An error caused by a user's macro will crash the main macro. Not sure if changing to and addin will fix this, but I'm hoping it will.
4. Only events for the application and part/dwg/assembly document objects are handled. Mostly because other objects' events are beyond the beginner/intermediate level.
5. There is a Busy flag as vbSpawn suggested. However, Any non-modal macro that is launched (e.g. one with a form) allows the main macro/addin code to continue running, which sets the Busy flag back to False. There's no way to determine if a user's non-modal macro is finished running. If the user's macro is non-modal and triggers events by its own running, those events will be seen by the main macro/addin.

I'm sure there may be others, but this is a start.

Comments?
 
Has anyone been able to create an add-in for this, I think this would solve several problems we are having.

Brian
 
handleman, this will have to be run once solidworks is started and not like an add-in correct?

Boottmills [soapbox]
SW2006 SP3.0
 
You mean the macro launcher in my last post? Yes, it would have to be run when SW is started. I can't turn it into an add-in because we're still running XP service pack 1. Stupid IS. Visual Basic Express requires XP SP2. It would really need to be an add-in anyway because, per the reasons TheTick outlined, addins are better at handling events. The macro is essentially just one big event handler. VBSpawn's addin would be better suited to the purpose in the OP, as it will be able to actually cancel the save operation if the user doesn't fill in properties as required. If my macro were turned into an addin it would be able to launch whatever macro you told it to launch on a Save event, but once the macro finished running the document would still be saved.
 
Hi once more,

and right now here you can download my PropForcer:

I guess it will work with any SWX Version,
if not just let me know.

befor you do anything read the ReadMe1st.rtf file.

I didn't include the source code, just because it's already posted above.

cheers and a great weekend
Michael
 
VBSpawn,

Ran a quick test last night...works quite well..thanks!

The only issue I have is since I am using it for only Custom Properties, each value in the template files exist with a "Space" as it's value. This registers as a property and allows it to go thru. So I suppose I'm asking for an enhancement request :).

Any way your next release could have it recognize a "space" as a blank entry field?

Boottmills [soapbox]
SW2006 SP3.0
 
If I understand it right, now space=blank="" ;o) just donwnload it again and replace your existing files ...


cheers
Michael
 
Thanks again...the Engineers hate it...the other departments love it...objective completed!

Boottmills [soapbox]
SW2006 SP3.0
 
VBSpawn ...
The "voice-of-europe" link no longer works. Would you mind re-posting? (see also faq559-1177 for other upload sites)

[cheers]
 
Hi,
yes I know and I suggested nobody need it (meanwhile)... so I decide to tune it up a lil bit.

I suppose all users will love the new Version... just because I added some new features like a NumberGenerator based upon a simple list file with prefix / postfix and a numberformatter.. you can attach diffrent ones @ each property.... but its not ready right now... I guess it will be finished next week and you all are welcome for my final test ... no Panic .. its 4 free ...

back to your problem... maybe I can upload this file next Saturday..

btw: additional feature requests r always welcome :)

cheers
Michael

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor