Importing Data   

<<< Introduction To Importing And Exporting Chapters Exporting Data >>>

Contents

[back to top]


90.1 Introduction

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.

[back to top]


90.2 Trimmed surface import route - summary

 

Figure 90-1 Trimmed surface import route

 

Related Topics:

[back to top]


90.3 Requirements for data import using the 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:

  • Lets you supply 2D analytic curves as well as 2D B-spline curves.
  • Allows you to either extend the supplied surface where the given SP-curves deviate slightly outside the parameter range of the surface, or adjust the SP-curves to ensure they fit within the surface limits.
  • Splits SP-curves at parametric degeneracies and G1 discontinuities in the underlying surface.
  • Produces a Parasolid Report of type PK_REPORT_record_3_t with a status of PK_REPORT_3_embed_curve_c providing additional information on the operation.
A 2D analytic curve, in this context, refers to a 3D analytic curve that lies in the Z=0 plane.

90.3.1 SP-curve data

90.3.1.1 Introduction

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:

  • Whether or not to create zero-length SP-curves to connect disjoint SP-curves that are created when trimmed curves pass through a degenerate surface.
  • Whether or not SP-curves are created in the same direction as the trimmed curves.
  • Whether or not to create SP-curves that are C2 continuous in the parameter space of the surface.

You can simplify geometry using PK_BODY_simplify_geom or PK_FACE_simplify_geom. See Section 64.2, “Simplifying geometry”, for more information.

90.3.1.2 Criteria

 

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

 

Note: Another consequence of the G1 parameter space requirement is that multi-segment linear curves are not allowed. Therefore, all applications making use of piecewise linear curves must convert them to G1 quadratics or higher order.

 

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.

90.3.2 Trimmed surface data passed into PK_SURF_make_sheet_trimmed

90.3.2.1 Introduction

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.

90.3.2.2 Options for PK_SURF_make_sheet_trimmed

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:

 

Option

Description

check_wires

Whether to identify wire topologies, e.g. seam lines, ensuring that the correct topology is made in such cases

Note: Opposing and coincident (within tolerance) curves should be supplied wherever wires are required.

check_self_int

Whether to check for topological self-intersections in the sheet body.

check_loops

Whether to check that face loops are consistent. Some limited corrective action is taken to reverse loops that are in the wrong direction, though this is not guaranteed to produce a valid sheet.

nominal_geom

Whether to attach supplied 3D curves as nominal geometry.

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”.

90.3.2.3 Criteria for SP-curves

 

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

 

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

 

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

90.3.2.4 Criteria for 3D curves

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:

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.

[back to top]


90.4 BREP import route

90.4.1 Sequence of events using BREP import route

 

 

Related Topics:

90.4.2 Importing topology

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.

90.4.3 Creating geometry

There is an extensive range of primary geometry functions. The majority of these have names of the form PK_<GEOM>_create, for example:

 

Geometry

Functions

Geometry

Functions

for points:

PK_POINT_create

for surfaces:

PK_BSURF_create

PK_CONE_create

PK_CYL_create

PK_FSURF_create

PK_OFFSET_create

PK_PLANE_create

PK_SPHERE_create

PK_SPUN_create

PK_SWEPT_create

PK_TORUS_create

PK_VECTOR_make_lsq_plane

for curves:

PK_BCURVE_create

PK_CIRCLE_create

PK_ELLIPSE_create

PK_FCURVE_create

PK_LINE_create

PK_SPCURVE_create

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.

90.4.4 Attaching geometry

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.

90.4.5 Sharing geometry

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.

90.4.6 Repairing the data

You can use the following functions to find and repair any self-intersections in the geometry you have created:

 

Functions

Usage

PK_CURVE_find_self_int

PK_CURVE_fix_self_int

Find and repair self-intersections in curves.

PK_SURF_find_self_int

PK_SURF_fix_self_int

Find and repair self-intersections in surfaces.

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.

90.4.6.1 Examples

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.

[back to top]


90.5 Relevant Parasolid restrictions and conventions

90.5.1 Face normals

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:

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”.

90.5.2 Loop directions and faces

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:

90.5.3 Non-manifold bodies

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”.

90.5.4 B-curves and edges

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.

 

[back to top]

<<< Introduction To Importing And Exporting Chapters Exporting Data >>>