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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Drawing Regenerate

bmortensen
2-Guest

Drawing Regenerate

I might be missing a point somewhere, but I'm trying to regenerate a Drawing. Sometimes the regenerate fails with Generel Error.


It seems to work if the drawing was already opened in Proe5, before my sync Jlink application is called.


If I have to open the drawing and display from the code the call fails. Is there any way to make sure the drawing is fully retrieved/displayed before calling the regeneration?



edit:


Actually i found that it fails if the model on the drawing is already displayed. If the model on teh drawing is in memory but not displayed itworks...


I tried to close the active window before opening the drawing, but that also failes.




Currently my code for loading and regeneration the drawing is roughly:


ModelDescriptor md = pfcModel.ModelDescriptor_CreateFromFileName("drawing.drw");

Model m = proeSession.RetrieveModel(md); 

Window win = proeSession.CreateModelWindow(model); 

win.Activate();        

model.Display();        

win.Refresh();        

win.Repaint();



Drawing d = (Drawing)m;

d.Regenerate();


thanks,


\Bjarne Mortensen


3 REPLIES 3

Hi,


I use Creo Elements 5.0 M 120 and Drawing regeneration works very nice.


I use this code, its similar to yours I think.


if (mdl.GetType() == ModelType.MDL_DRAWING) {
((Drawing) mdl).Regenerate();
}


Best regards,


Eike



Aunt Edit:


Sry ... I have an async Java application. So I don't know about your problem.

bfrandsen
6-Contributor
(To:bmortensen)

The drawing is implicitly regenerated upon retrieval, so there is no need to regenerate it in that use case.
Also the config option auto_regen_views will influence your program. Setting it to yes should regenerate the drawing when activating the window.

Best Regards,
Bjarne Frandsen

I guess you're right


My problem was that I had a relation that needed to be regenerated on the drawing model. So I was looking in the wrong place.


I just needed to call RegenerateRelations() on the Model object



\Bjarne

Announcements


Top Tags