cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Import relations file

Bari
14-Alexandrite

Import relations file

Hello all,

We can import relations into our models using a text file but if there are already some previous relations in the model they get erased when importing the file. Is there any way of preserving the already existing relations when importing new ones?

Thanks,

A. Baridó

ACCEPTED SOLUTION

Accepted Solutions
BrianMartin
12-Amethyst
(To:Bari)

Hi Antonio...

Two options come to mind. first, consider adding your new relations as "Post Regeneration" (or moving your old ones if appropriate). Post regeneration relations are good for things like mass properties calculations because they are evaluated after the model has been regenerated. However, if your relations are controlling dimensions, you'll probably want to keep them set to Initial so the values are evaluated before the model is actually regenerated.

relations.png

If Post Regeneration isn't an option, plan "B" would be to make a mapkey that first exports your existing relations as a text file, merges them with the new relations, and then imports the merged list. You can concatenate or merge two text files in several ways. Perl is my favorite text file processing utility... but you can easily do this with a Windows batch script, too.

To bring it all together, you'll probably want to write a series of mapkeys. I'd have one mapkey to export your relations. Then, I'd have another mapkey setup to run the small batch script or perl script to merge the files. Next, I'd create one mapkey would read back in the merged file. Finally, I'd create one last mapkey which runs the other 3 mapkeys in sequence. This gives you ONE key to do the entire operation.

If you need further advice, a sample batch script to merge the files, or even a full demonstration, let me know. I love helping people with issues like this- but I'm getting absolutely buried at work these days. It's been tough for me to write back quickly. Still, if you get stuck, I'll try to carve out some time to step you through the process.

Thanks!

-Brian

View solution in original post

3 REPLIES 3
BrianMartin
12-Amethyst
(To:Bari)

Hi Antonio...

Two options come to mind. first, consider adding your new relations as "Post Regeneration" (or moving your old ones if appropriate). Post regeneration relations are good for things like mass properties calculations because they are evaluated after the model has been regenerated. However, if your relations are controlling dimensions, you'll probably want to keep them set to Initial so the values are evaluated before the model is actually regenerated.

relations.png

If Post Regeneration isn't an option, plan "B" would be to make a mapkey that first exports your existing relations as a text file, merges them with the new relations, and then imports the merged list. You can concatenate or merge two text files in several ways. Perl is my favorite text file processing utility... but you can easily do this with a Windows batch script, too.

To bring it all together, you'll probably want to write a series of mapkeys. I'd have one mapkey to export your relations. Then, I'd have another mapkey setup to run the small batch script or perl script to merge the files. Next, I'd create one mapkey would read back in the merged file. Finally, I'd create one last mapkey which runs the other 3 mapkeys in sequence. This gives you ONE key to do the entire operation.

If you need further advice, a sample batch script to merge the files, or even a full demonstration, let me know. I love helping people with issues like this- but I'm getting absolutely buried at work these days. It's been tough for me to write back quickly. Still, if you get stuck, I'll try to carve out some time to step you through the process.

Thanks!

-Brian

Bari
14-Alexandrite
(To:BrianMartin)

Thanks Brian for your valuable description and effort to conciliate your job and helping the community.

Regards,

A. Baridó

BrianMartin
12-Amethyst
(To:Bari)

Thanks Antonio...

When I can't do everything all at the same time, I feel like I'm letting people down. This is why I try never to sleep!

Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags