Apprentice

Apprentice

NachoShaw
Advisor Advisor
303 Views
2 Replies
Message 1 of 3

Apprentice

NachoShaw
Advisor
Advisor

Hey

 

judging by the lack of response to any of my posts, i feel that this will also fall on deaf ears but i'll post it anyway. As a side note, i do go to the effort of detailing any queries i have informatively.....

 

Apprentice Behavior.

Using the CopyDesign code from SDK (which i might add, is flakey - take note Autodesk) i am getting different mixed results.

 

I have 1 class to copy an assembly from 1 location to another and rename it.

I have 2 assemblies to copy separately. 

First assembly is renamed A_Assembly.iam

Second assembly is renamed A_Assembly-01.iam (this is in a loop)

 

A_Assembly.iam

When i open this, The assembly name is correct. All of the sub components are also named A_part1, A_Part2 etc. as are the components in the folder. So, the name of the actual component is the name in the browser.

 

A_Assembly-01.iam

When i open this, all of the components are NOT named correctly but the components in the folder are. for example:

in the folder, A_Assembly-01.iam exists. when i open it, its called 'Assembly' in the browser. If i delete the browser node name, it will revert to A_Assembly-01. Same with the sub components.

 

Question is why when both assemblies are copied in the same way with the same code? This gives me problems because when i insert A_Assembly-01, A_Assembly-02 into the main assembly, i need them to be named as so but because they are showing a different name in the browser, they appear as Assembly:1, Assembly:2 which is incorrect. They are not 2 occurrences of the same assembly, they are different assemblies.

 

I have checked the component name & path in iProperties and they are as they should be

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
304 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor

Hi @NachoShaw 

I tried Copy Design from the SDK and couldn't reproduce the error. It sounds however that it's the displayname of your documents that are changed... I mean if you open a document and set the DisplayNameOverriden property to false (Inventor API) It should update to the correct name.

The DisplayNameOverriden doesn't seem to exist in Apprentice though, but the DisplayName property does. I can't see the displayname being changed in anywhere in the original SDK code but maybe you're modifying it somehow in your code?

Maybe you can set the displayname of all your created documents to the document filenames in the code as a workaround?

Could you give any more info about how to reproduce the error? Maybe attach some files and a sample vs-project?

 

Also, I can imagine the reason that you aren't getting a lot of responses on your posts is because you tend to abandon them whenever you get answers. I can only speak for myself but for me it's no fun to get zero feedback on a response. If my suggestions don't work I'd like to know so I can investigate why and hopefully learn from it. If they do work, you can accept as solution and I'll know. I mean, the fun part of this forum is to discuss and solve problems togeather 🙂

 

Message 3 of 3

NachoShaw
Advisor
Advisor

Hey

 

thanks for the reply. Apologies if it seems i abandon my responses, i do mean to reply back but you know, young kid gets in the way. I'll make sure to be more responsive 🙂

 

I seem to have figured it out. Still using the SDK as base code but altered to suit new name. It seems that folder placement is important (at least in this case). for example:

 

Template folder

ROOT - Where Assembly.iam is

   REFS/TYP - Where Assembly-01.iam is

 

Copy Folder

ROOT - New A_Assembly.iam

   TYP-01 - New A_Assembly-01.iam

 

in the above, the A_Assembly-01.iam is placed in a folder level down from its origin.

 

i changed the template location from REFS/TYP to TYP and it resolved the issue.

 

i know that reading the code, it really shouldnt matter but even the SDK code itself will use the same level folders. Maybe its just a glitch but changing the folder structure to a same level method worked.

 

 

Thanks and much appreciated

 

 

N

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.