Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello friends ,
I am new in Creo Customization , I have use ProDrawingDimensioncleanup function to auto allign the all dimension in sheet , for that I set the value cleanup offset dimension and cleanup dimension incremental value through program but still dimensions are going out of sheet boundary , please help me to resolve the issue .
Hi
You need to remove all annotations that are based on dimensions, or simpler all annotations. So you could do it much nicer than the code below ... but it could be work something like this:
/*====================================================================*\
FUNCTION : removeAllAnnotations()
PURPOSE :
\*====================================================================*/
ProError removeAllAnnotationsDtlVisitAction(ProDtlitem* item, ProError filt_status, ProAppData appdata) {
ProDrawingAnnotationErase(ProDrawing(item->owner), item);
return PRO_TK_NO_ERROR;
}
ProError removeAllAnnotationsDimensionVisitAction(ProDimension* dimension, ProError filt_status, ProAppData appdata) {
ProDrawing * drw = NULL;
if (appdata != NULL)
drw = (ProDrawing*)appdata;
ProDrawingAnnotationErase(appdata != NULL ? *drw : ProDrawing(dimension->owner), dimension);
return PRO_TK_NO_ERROR;
}
ProError removeAllAnnotationsSolidVisitAction(ProSolid solid, ProError filt_status, ProAppData appdata) {
ProSolidDimensionVisit(solid, PRO_B_TRUE, removeAllAnnotationsDimensionVisitAction, NULL, appdata);
ProSolidDimensionVisit(solid, PRO_B_FALSE, removeAllAnnotationsDimensionVisitAction, NULL, appdata);
return PRO_TK_NO_ERROR;
}
//FUNCTION
ProDrawing drw = ProDrawing(mdl);
int sheet;
if (ProDrawingCurrentSheetGet(drw, &sheet) == PRO_TK_NO_ERROR) {
ProDrawingDtlnoteVisit(ProDrawing(mdl), NULL, sheet, removeAllAnnotationsDtlVisitAction, NULL, NULL);
ProDrawingDtlentityVisit(ProDrawing(mdl), NULL, sheet, removeAllAnnotationsDtlVisitAction, NULL, NULL);
}
ProDrawingDimensionVisit(drw, PRO_DIMENSION, removeAllAnnotationsDimensionVisitAction, NULL, NULL);
ProDrawingDimensionVisit(drw, PRO_REF_DIMENSION, removeAllAnnotationsDimensionVisitAction, NULL, NULL);
ProDrawingSolidsVisit(drw, removeAllAnnotationsSolidVisitAction, NULL, &drw);
// FUNCTION END
Br,
Eike
Hi KB,
Get ProDrawing and ProView handle of the required model you need to clean dimensions in it.
Then pass these two handles into that ProDrawingDimensionsCleanup() function.
Make sure to use "s" in the ProDrawingDimensionsCleanup function.