Skip to main content
1-Visitor
February 23, 2012
Question

Drawing Regenerate

  • February 23, 2012
  • 3 replies
  • 1625 views

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

15-Moonstone
February 23, 2012

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.

10-Marble
February 24, 2012
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
1-Visitor
March 5, 2012

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