Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello All,
I have a model (First.prt); it's used in drawing and assembly.
Everything is open and active in Creo Parametric.
Now I have to replace this First.prt (First.prt.9) with a updated version which I have received from my team-mate.
This should
1 Replace exiting part Or make new version using updated file.
2. New updates should be visible in creo session.
3. It must update related drawing and assembly.
All this should be done on a button/Menu click; that means user is not going to close creo.
So far I have:
1. Copied the updated file and renamed it with updated version number (say First.prt.10).
2. Load the model in creo. and activate the window.
but updates are not reflacted until I re-open Creo 😞
I am sure there must be some way to achieve the expected output; which I am not aware of 😐
Can someone help me in this?
Madhavi
From what you are describing it looks like you are trying to load First.prt.10 while First.prt.9 is still in session. You can not have two models with the same name in session. Check and make sure you actually loaded version 10 of the part in session.
To acomplish what you are looking for you need to:
1. Close and erase from memory any drawing that has first.prt as an associated model
2. suppress all occurences of first.prt in the assembly
3. Erase first.prt from memory. Check the return of erase function. If first.prt is still used someware it will return an error code.
4. copy/rename updated version of first.prt
5. load updated first.prt in session. Make sure is the version you desire - no need to display the window
6. resume suppressed components
7. reopen the drawing
Thanks for reply!
I get updated model (version 10) from another machine/user after opening version 9.
Anyways
I saw a function ProDrawingSolidReplace and I was wondering if Toolkit has a function to replace the model. That will be better solution.
Closing the models and then re-opening it (specially when user is working on 15+ models) might be lil weird/strang for end user. Specially when few of those models are updated and not yet saved.
Please read the documentation regarding ProDrawingSolidReplace.
It works only for family table instances.
Other than that I strongly recommend AGAINST what you are trying to do. Soon you and your coworkers will start asking which is the correct model to use and no one will be able to answer.
Thanks for your input.
I read the document and I know it's not just replacement of Drawing.
Again as I said I am looking for a functionality which will allow to Replace model.
It's very common functionality when you develop an interface using Toolkit.
One should expect some other app to update the model and then give it back to creo using this interface.
I think that Windchill can already do this.
My project does not use WindChill 😐
Thanks for reply tho!
Use ProSolidFeatVisit to visit all features of the assembly. Set the filter function to look for components only.
From there you can use ProAsmcompMdlGet and ProMdlMdlnameGet to get the component name.
Alternatively you can use ProAsmcompMdlMdlnameGet.
If the model name is the one you want to replace use ProFeatureWithoptionsSuppress to suppress the component.
Thank you. 🙂
Hello @GabrielZaha ,
I am trying to achieve the expected output and here are few hurdles I am facing:
1. ProMdlErase / ProMdlEraseAll : Does not clear the ProSessionMdlList. May be because control is not returning back to Creo. ProMdlErase / ProMdlEraseAll does not give any error but if I check the SessionMdlList then I get erased models there 😞
2. At the end when I try to open the updated model using
2.1 ProMdlWindowGet // to check if model is already displayed ( should happen as I clear the model from session. I have also used ProWindowDelete and ProWindowCurrentClose?)
2.2 ProMdlErase
2.3 ProMdlFiletypeLoad() ProMdlMdlnameGet() then ProMdlTypeGet() then ProObjectwindowMdlnameCreate() then ProWindowCurrentSet()
ProWindowActivate() to activate the window
ProMdlDisplay() to display the window.
But still it does not display the model in new window.
If model was already opened then ProObjectwindowMdlnameCreate gives same WindowID which was returned by ProMdlWindowGet before closing the window.
Do you see any problem in this sequnce? is there any obvious mistake?
Please suggest me what I shall try?
Warm regards,
Madhavi