I've got a problem with moving (in my case "move" means "copy to...") Occurrences without renaming them.
Every time, when I'm executing the following Code:
_occ.Replace(nPath, true); //npath = where to move, same FileName; _occ = SolidEdgeAssembly.Occurrence
it changes nothing. No error, no warn. Nothing.
When I'm trying to replace this occurence with copied one manually, I'm getting an error, which is saying more or less:
"You're not allowed to replace this occurrence with the same occurrence from another folder".
Is there any other way to do this properly with Solid Edge API?
Regards from Poland,
Solved! Go to Solution.
It seems to be the expected behavior.
When replacing a file that is in the same directory that the assembly, you cannot replace it by a file with the same name.
It works exactly the same way when you do it in Solid Edge.
Try to change the name of the copy and then replace.
@rbertin - thank you for your reply.
It seems to work as expected, but it is not.
Steps to reproduce:
Hint: replacement file has the same name as replaced, but physicaly is stored in other folder!
1. copy file to any other location, without changig FileName
2. replace occurrence with the copied file (both files have the same Name)
All I want to do is to "organize" the structure of parts in SE-Assembly programatically.
I think you have to Move instead of Copy.
If you try to replace a part by another one with the same name, Solid Edge asks you for use the part that is currently loaded in the assembly.
It only allows you to replace a part by a file with the same name if the link to that part is broken and you are "redefining" it.
You can use the command "save as.." with the same name to a new location and Solid Edge will create the new file and "point" to that new file.
Héctor Pelayo Izquierdo
Engineering Department, JAE Ingeniería y Desarrollos, S.L.
Solid Edge ST9 MP5 | NX 9