Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Map old Materials Database to a new one

Status
Not open for further replies.

DFC332

Mechanical
Sep 29, 2006
4
We have used the default SolidWorks Materials Database and several of our own databases for over a year. Up until now, no control existed over the creation or modification of our data; users created materials and databases as they had the need.

Now we want/need to implement a new Materials Database to clean up this mess. When it's done, we want to erase the old stuff.

We have finished the new database (as we believe we want it as the finished product). As much as possible, existing material names and properties have been copied from the old files into the new (except for junk).

We then replaced the old sldmat files with the new one. Now when a part is opened and the material is edited, a warning says the material could not be found and a "Temporary Database" is started.

OK, this behavior is expected: I’ve eliminated a data source and I haven’t done anything to tell the part to look elsewhere for data. What I'm looking for is a method or a macro or a suggestion on how to map the material name from one database to another. I’m thinking that a macro could do this, but I have zero experience with writing macros.

Would it be possible to open a part and execute a macro that queries the existing material name and maps it to the new sldmat file? And as long as I’m asking, could this be done as a bulk process (Task Scheduler maybe??) ?


Thanks for yer support! and please, minimize the scolding :-(

DC

SolidWorks 2007 SP 2.1
Windows XP
 
Replies continue below

Recommended for you

We then replaced the old sldmat files with the new one
To clarify ... You replaced the original solidworks materials.sldmat in the SolidWorks install folder?

[cheers]
SW07-SP3
 
Good point.

No, I have not touched the original solidworks materials.sldmat file.

We have a network location that everyone maps to in their System Options / File Locations / Material Databases.

DC
 
Is the Tools > Options > System Options > File Locations pointing to the correct location?

[cheers]
SW07-SP3
 
YES

We have a network location that everyone maps to in their System Options / File Locations / Material Databases.

DC
 
I believe the material database is in XML. If you are careful it may be possible to literally cut and paste the entries from one database to another. Open the files in notepad. Study the file. Find the entries in the database you want to copy. Copy those entries and paste them into your desired new database. I have never tried this, but don't see why it wouldn't work...

Pete
 
Yes it is xml.

If you go that route make a backup of the original file ... just in case.

[cheers]
SW07-SP3
 
In my original post, I stated that the sldmat files were edited, data was copied where appropriate, junk eliminated, etc ....

The editing of the sldmat files is not the problem.

The problem is the name of the files.

Let me use an example:
I have assigned material to a part from a file "My Materials.sldmat" containing AISI 304.
There is a new material file "Company Materials.sldmat" containing AISI 304.
I want to eliminate "My Materials.sldmat".

When "My Materials.sldmat" is removed, then I open my part and edit the material, AISI 304 is not recognized and a Temporary Database is opened.

I must fix the problem by manually picking "Company Materials" and then AISI 304.

So, I have a method that works, but I want to know is if there is a means to automate or simplify or mass execute this process using a macro or some other means.

Thanx.
DC
 
For you to do this in a macro, there will need to be already existing objects that know how to handle a .sldmat file. Since SW is VB.NET based, there should be something, but it may not be available to call from the API. If know one here knows, I would check with your VAR.

Matt
CAD Engineer/ECN Analyst
Silicon Valley, CA
 
I think for each part that uses the old database, you will need to remove the mtl, save the part, then add new mtl. There may be a macro already to do this.
We will have to search around.

Chris
SolidWorks 07 3.0/PDMWorks 07
AutoCAD 06
ctopher's home (updated 03-26-07)
 
Check this topic:

Set Material Property Name Example (VB)

in SolidWorks and Add-Inns API help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor