![]() |
Importing Data |
<<< Introduction To Importing And Exporting | Chapters | Exporting Data >>> |
This chapter explains how models created by other modellers can be imported into Parasolid.
A model can only be successfully imported if its topology can be expressed as valid Parasolid topology, and its geometry corresponds to valid Parasolid geometric types.
There are two routes for importing external model data. These are:
Which one to use in a given situation is dependent on whether the application knows the BREP topology of the model. When this is known use the BREP route. When the topology isn't known the data must be supplied in the form of trimmed surfaces (that is, as surfaces bounded by loops of surface parameter (SP) curves) in order to make use of the trimmed surface import route.
Note: Facet geometry cannot be imported into Parasolid via the trimmed surface import route. |
For examples of both of these routes, see the code examples in the
C++\Code Examples\Application
Support\Data
Import
folder, located in
example_applications
in your Parasolid installation folder.
Figure 90-1 Trimmed surface import route
To model successfully in Parasolid with externally created models, there are some requirements that the imported data must satisfy. This section explains these requirements.
Note: This section discusses creating SP-curve data using PK_SPCURVE_create. PK_CURVE_embed_in_surf_2 performs a similar function to PK_SPCURVE_create, and can be used in place of it in all references throughout this section. The functions differ in that PK_CURVE_embed_in_surf_2:
|
To create an SP-curve from surface and uv-space B-spline data call PK_SPCURVE_create. The surface given to PK_SPCURVE_create can be any Parasolid surface provided that it is an orphan. It is permissible for this surface to contain parametric singularities.
Note: PK_SPCURVE_create can only create SP-curves from 2D trimming curves and surfaces. If the data you are importing consists of surfaces and 3D trimming curves, use PK_CURVE_make_spcurves_2 instead. PK_CURVE_make_spcurves_2 contains options that let you control:
|
You can simplify geometry using PK_BODY_simplify_geom or PK_FACE_simplify_geom. See Section 64.2, “Simplifying geometry”, for more information.
Note: All SP-curves generated by Parasolid for its own use, e.g. during a PK_EDGE_set_precision_2 operation, are non-rational quadratic curves. |
Figure 90-2 SP-curve in 3-space
Figure 90-3 SP-curve is G1 in 3-space, but not in uv-space
Figure 90-4 SP-curve with small hook
Figure 90-5 SP-curve with high curvature S-bend in the middle
It is extremely difficult to specify exact figures for the minimum radius of curvature which imported SP-curves should meet in order that Parasolid models with the part reliably. Therefore these previous examples are guidelines as to which configurations are likely to be problematic.
To create a sheet body, with a single face, from given surface geometry for the face and curve geometry for the edges, use PK_SURF_make_sheet_trimmed. Using this method of creation the topology of the resulting sheet is inferred from the geometry.
PK_SURF_make_sheet_trimmed receives a set of trim data consisting of a combination of SP-curves and 3D curves, together with information about intervals, face sets, and loops.
The curves that you pass to PK_SURF_make_sheet_trimmed must satisfy a set of criteria in order to be usable by the function: different criteria need to be satisfied depending on whether you are passing SP-curves or 3D curves. See “Criteria for SP-curves” and “Criteria for 3D curves”, respectively.
In addition, PK_SURF_make_sheet_trimmed receives a set of options. See “Options for PK_SURF_make_sheet_trimmed”, for details.
Faces in Parasolid obey a rule for determining on which side of a boundary the face lies. Namely:
“With the face normal upward and the tangent direction of the boundary curve forward, the area of surface within the face is on the left.”
If the data supplied to PK_SURF_make_sheet_trimmed implies the area of the surface within the face is on the right then the face sense is automatically set such that the outward side of the face is the reverse side of the surface. This then restores the ‘on the left’ rule.
The front side of the sheet can, in any case, easily be switched using PK_BODY_reverse_orientation.
As PK_SURF_make_sheet_trimmed is designed for importing geometric data from other solid modelers which work to coarser accuracies than Parasolid, the geometry that is supplied need not conform to Parasolid's strict tolerances.
PK_SURF_make_sheet_trimmed contains options allowing you to perform a range of different checks on the data. When used, these pick up the majority of the problems. The options you use should reflect your certainty about the validity of the data (for instance, following a call to PK_GEOM_check).
The following options are available:
If all input sheet bodies pass these checks, your application can do one of the following:
For details on both of these techniques, see Chapter 46, “Sewing and Knitting”.
Figure 90-6 Trimmed curves part of whole loop
From this data Parasolid computes vertex point and tolerance:
Figure 90-7 Trimmed curves part of whole loop plus computed vertex and tolerance
P is the average centroid point computed using end of C1 and start of C2. The tolerance is the maximum distance of C1 or C2 away from P.
Note: If C1 and C2 do not follow on to within specified tolerances (as in the case in
Figure 90-6) PK_SURF_make_sheet_trimmed does NOT attempt corrective action in the case where C2 is reversed accidentally with respect to C1. |
Figure 90-8 SP-curves within edge tolerance of sum of others with no common vertex
Where SP-curves do share a common vertex, the curves should not come within the appropriate edge tolerance sum of one another after separating at the vertex.
Figure 90-9 SP-curves within edge tolerance of sum of others with no common vertex
Figure 90-10 Edge E2 is wholly within E1 tolerance + E2 tolerance of E1
Note: All the configurations in Figs. 8, 9 and 10 can be detected by the means of the checking option
check_self_int
. |
Figure 90-11 Examples of SP-curves and their vertices
The data you are importing may contain 3D curves that represent the boundary loop of the trimmed surface, as well as (or instead of) SP-curves. PK_SURF_make_sheet_trimmed can receive these 3D curves using the same
spcurves
field in the
trim_data
structure received by PK_SURF_make_sheet_trimmed.
Any 3D curves supplied must do one of the following:
surf
.
In the latter case, Parasolid creates an SP-curve based on the supplied curve, and then can attach the supplied 3D curve as nominal geometry (depending on the setting of the
nominal_geom
option: see “Options for PK_SURF_make_sheet_trimmed”). When creating an SP-curve, Parasolid may extend the supplied surf so that the surface of the resulting sheet body includes the entire length of the SP-curve.
You can create topology using the generic create function PK_BODY_create_topology_2, whose arguments define the topological entities and the relations between them. The topological entities are defined using the following classes:
All of the body’s regions, shells, faces, loops, edges, and vertices must be present in the input. However, the presence of fins is optional, since these can be inferred from the loop that is the parent of each edge.
The first region received by PK_BODY_create_topology_2 must be the outer region of the body.
You must specify the sense of:
Wire bodies do not have any faces. For sheet bodies, each face appears twice in a shell with different senses.
There is an extensive range of primary geometry functions. The majority of these have names of the form PK_<GEOM>_create, for example:
B-geometry can also be created from spline data or piecewise data using:
As well as these there is a wide range of functions of the form PK_ <GEOM>_make_ <something> which make geometry from other geometry.
You can simplify geometry using PK_BODY_simplify_geom or PK_FACE_simplify_geom. See Section 64.2, “Simplifying geometry”, for more information.
To create a valid body, you must attach geometry of the correct class to all of its vertices, edges and faces; these entities having been returned by the appropriate PK_BODY_create_<body_type>_topology function. You can make any geometry construction geometry of the body using PK_PART_add_geoms before attaching it to particular topological entities.
You should attach the geometry to topology using the following functions in the order shown:
PK_EDGE_attach_curves_2 accepts an option structure that lets you control:
You must also ensure that curve directions and surface normal directions are correct. Parasolid conventions regarding curve directions and surface normal directions are described in Chapter 14, “Model Structure”. You can determine curve direction using PK_CURVE_eval. When a curve is attached to a face using PK_EDGE_attach_curve_2 your application must indicate whether the curve direction is in the same or opposite direction to that of the edge. You can determine surface normal direction using PK_SURF_eval_with_normal. When a surface is attached to a face using PK_FACE_attach_surfs your application must indicate whether the surface normal is in the same or opposite direction to that of the face normal.
If you disable geometry checking using the
geom_checking
option in PK_EDGE_attach_curves_2, this overrides the session settings for checking continuity (defined using PK_SESSION_set_check_continuity) and self-intersections (defined using PK_SESSION_set_check_self_int), for the duration of the call to PK_EDGE_attach_curves_2.
If you do not want to use the
geom_checking
option, you can set the checking behaviour for continuity and self-intersections separately, dependent on the nature of your data, as follows:
If you use these functions to attach geometry, then you should turn the settings off again afterwards. You should also try to repair any problems that have been created using PK_FACE_repair and PK_EDGE_repair, or using a dedicated toolkit such as Parasolid Bodyshop.
Once all the geometry has been attached, you should call PK_BODY_share_geom to remove any duplicate curves and surfaces. This reduces the size of the model by allowing curves and surfaces to be shared wherever possible.
PK_BODY_share_geom also ensures that SP-curves refer to the surfaces attached to faces when the geometry was constructed.
You can use the following functions to find and repair any self-intersections in the geometry you have created:
You can also use PK_SURF_fix_degens and PK_CURVE_fix_degens to repair degeneracies in any surfaces and curves you have created.
For an example of this functionality, see the code example in the
C++\Code Examples\Inquiries\Model
Analysis\FindAndFixDegeneracies
folder, located in
example_applications
in your Parasolid installation folder.
After the geometry has been attached, the part may need to be repaired to ensure that Parasolid tolerances are met as follows:
If desired, PK_EDGE_reset_precision_2 may be called on the edges. This attempts to compute accurate edge curves for non-tangent edges by intersecting the adjacent surfaces. Alternatively, the edges may be left with local tolerances.
Note: SP-curves that cross surface degeneracies will be fixed by splitting if possible. To repair surface degeneracies, additional calls to PK_SURF_find_degens and PK_SURF_fix_degens are required. |
You can find code examples that demonstrate how to establish the topology of a given model and how to import it into Parasolid using PK_BODY_create_topology_2 in the ExampleApplication folder on the Parasolid Jumpstart Kit.
By convention in Parasolid, all face normals in a solid body point out of the material of the body. For faces bounding voids this means the normals point into the void. Face normals are determined by:
The sense of a face is set by the
senses
argument to PK_FACE_attach_surfs:
You can also reverse the orientation of a face in a non-manifold body using PK_FACE_reverse.
For more information, see Section 14.7, “Relationships between topology and geometry of manifold bodies”.
In Parasolid, the face of a loop is on its left, when looking from outside the material of the body and moving in the loop direction.
If the modeler from which a body is being imported has the opposite convention, all loop directions need to be reversed. This is done by either:
All Parasolid bodies that are created in a session where PK_SESSION_set_general_topology has not been run must be manifold, objects such as T-sheets or solid regions meeting at a point are not permitted.
For further information on manifold bodies and generalized topology, see Chapter 15, “Body Types”.
The B-curve of an edge must be G1 continuous. It can have multi-segments so long as it is G1 continuous. If a B-curve is not G1 continuous it needs to be split at the G1 discontinuities, each of which can be attached to a separate edge.
<<< Introduction To Importing And Exporting | Chapters | Exporting Data >>> |