1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public static unsafe PK.BODY_t[] horizontalSlice(PK.BODY_t body, double height, double defaultTol=0, double maxTol=0.0003)
{
//change the current partition
PK.PARTITION_t partition = new PK.PARTITION_t();
PK.PARTITION_t* pPartition = &partition;
PK.ENTITY.ask_partition(body, pPartition);
PK.PARTITION.set_current(partition);
//make horizontal plane
PK.PLANE_t plane = makeHPlane(height);
//intersection
PK.TOPOL.track_r_t tracking = new PK.TOPOL.track_r_t();
PK.TOPOL.track_r_t* pTracking = &tracking;
PK.BODY.make_section_r_t results = new PK.BODY.make_section_r_t();
PK.BODY.make_section_r_t* pResults = &results;
PK.SURF_t[] tool = new PK.SURF_t[1];
tool[0] = plane;
PK.BODY.make_section_o_t options = new PK.BODY.make_section_o_t(defaultTol, maxTol, false, false, PK.BODY.type_t.wire_c, PK.boolean_update_t.default_c);
PK.BODY.make_section_o_t* pOptions = &options;
PK.BODY_t[] bodyArr = new PK.BODY_t[1];
bodyArr[0] = body;
error = PK.BODY.make_section_with_surfs(1, bodyArr, 1, tool, pOptions, pTracking, pResults);
return Util.convertToArray(pResults->bodies, pResults->n_bodies);
} |
Partager