Toggle menu
71
399
28
3.6K
Medusa: Coordinate Free Meshless Method implementation
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Computer-aided design - Importing IGES and STEP files

From Medusa: Coordinate Free Meshless Method implementation

Go back to Examples.

STEP and IGES files can be directly translated into Medusa's NURBSShape if they only contain NURBS objects. Helper functions, which do that, are provided in the Medusa-Extras repository. For their usage, OpenCASCADE library must be installed on the system.

Some example CAD models are also provided in the repository, code that discretizes a tiger model using the strategy described in Determining the interior of the domain by oversampling the boundary is shown below

NURBSShape<Vec3d, Vec2d> shape = translate_STEP("examples/tiger.step");
double h = 2;

// Oversample the domain.
DomainDiscretization<Vec3d> oversampled_domain = shape.discretizeBoundaryWithStep(h / 5);

for (int i = 0; i < oversampled_domain.size(); i++) {
    oversampled_domain.normal(i) *= -1;
}

// Construct the contains function.
KDTree<Vec3d> contains_tree;
oversampled_domain.makeDiscreteContainsStructure(contains_tree);
auto contains_function = [&] (const Vec3d p) {
    return oversampled_domain.discreteContains(p, contains_tree);
};

// Fill the boundary normally.
DomainDiscretization<Vec3d> domain = shape.discretizeBoundaryWithStep(h);

// Fill the interior with the contains function.
KDTreeMutable<Vec3d> tree;
GeneralFill<Vec3d> gf;
gf(domain, h, tree, contains_function);

Using the provided plot script, we get