In toolkit examples (UgCreoSweepCreate.c) I found this piece of code
ProError UgSweepAppAddRectangle (ProSection nsketch,int offset)
{
Pro2dLinedef rect_entity1,rect_entity2,rect_entity3,rect_entity4;
int ent_id=0;
rect_entity1.type = PRO_2D_LINE;
rect_entity1.end1[0] = -50 + (-offset);
rect_entity1.end1[1] = 40 + offset;
rect_entity1.end2[0] = 50 + offset;
rect_entity1.end2[1] = 40 + offset;
rect_entity2.type = PRO_2D_LINE;
rect_entity2.end1[0] = 50 + offset;
rect_entity2.end1[1] = 40 + offset;
rect_entity2.end2[0] = 50 + offset;
rect_entity2.end2[1] = -40 + (-offset);
rect_entity3.type = PRO_2D_LINE;
rect_entity3.end1[0] = 50 + offset;
rect_entity3.end1[1] = -40 + (-offset);
rect_entity3.end2[0] = -50 + (-offset);
rect_entity3.end2[1] = -40 + (-offset);
rect_entity4.type = PRO_2D_LINE;
rect_entity4.end1[0] = -50 + (-offset);
rect_entity4.end1[1] = -40 + (-offset);
rect_entity4.end2[0] = -50 + (-offset);
rect_entity4.end2[1] = 40 + offset;
status = ProSectionEntityAdd(nsketch,(Pro2dEntdef*)&(rect_entity1),&ent_id);
sweep_create_log("ProSectionEntityAdd ");
status = ProSectionEntityAdd(nsketch,(Pro2dEntdef*)&(rect_entity2),&ent_id);
sweep_create_log("ProSectionEntityAdd ");
status = ProSectionEntityAdd(nsketch,(Pro2dEntdef*)&(rect_entity3),&ent_id);
sweep_create_log("ProSectionEntityAdd ");
status = ProSectionEntityAdd(nsketch,(Pro2dEntdef*)&(rect_entity4),&ent_id);
sweep_create_log("ProSectionEntityAdd ");
status = ProSectionIntentManagerModeSet(nsketch, PRO_B_TRUE);
sweep_create_log("ProSectionIntentManagerModeSet ");
status = ProSectionIntentManagerModeSet(nsketch, PRO_B_FALSE);
sweep_create_log("ProSectionIntentManagerModeSet ");
return;
}
Try to use something like this
Point2Ds tops = Point2Ds.create();
Point2D A = wfcSession.CreatePoint2D(90.00,90.00);
Point2D B = wfcSession.CreatePoint2D(90.00,-90.00);
Point2D C = wfcSession.CreatePoint2D(-90.00,-90.00);
Point2D D = wfcSession.CreatePoint2D(-90.00,90.00);
Point2D E = wfcSession.CreatePoint2D(90.00,90.00);
tops.set(0, A); tops.set(1, B); tops.set(2, C); tops.set(3, D); tops.set(4, E);
SectionEntityPolyline rectangle = wfcSection.SectionEntityPolyline_Create(tops);
SectionEntity entity = (SectionEntity)rectangle;
sketch.AddEntity(entity);
// ADD
sketch.SetIntentManagerMode(true);
sketch.SetIntentManagerMode(false);