Revision: 57070
http://sourceforge.net/p/brlcad/code/57070
Author: brlcad
Date: 2013-08-22 17:10:21 +0000 (Thu, 22 Aug 2013)
Log Message:
-----------
include comments and logically break up the wall of code so I can understand
what's going on
Modified Paths:
--------------
brlcad/trunk/src/conv/step/g-step/ON_Brep.cpp
Modified: brlcad/trunk/src/conv/step/g-step/ON_Brep.cpp
===================================================================
--- brlcad/trunk/src/conv/step/g-step/ON_Brep.cpp 2013-08-22 17:00:43 UTC
(rev 57069)
+++ brlcad/trunk/src/conv/step/g-step/ON_Brep.cpp 2013-08-22 17:10:21 UTC
(rev 57070)
@@ -216,8 +216,9 @@
step_srf->knot_spec_(Knot_type__unspecified);
}
+
// STEP needs explicit edges corresponding to what in OpenNURBS are the UV
space trimming curves
-int Add_Edge(ON_BrepTrim *trim, Registry *registry, InstMgr *instance_list,
std::vector<STEPentity *> *oriented_edges, std::vector<STEPentity *>
*edge_curves,std::vector<STEPentity *> *vertex_pnts){
+int Add_Edge(ON_BrepTrim *trim, Registry *registry, InstMgr *instance_list,
std::vector<STEPentity *> *oriented_edges, std::vector<STEPentity *>
*edge_curves, std::vector<STEPentity *> *vertex_pnts) {
ON_BrepEdge *edge = trim->Edge();
int i = -1;
if (edge) {
@@ -230,11 +231,11 @@
if (trim->m_bRev3d) {
oriented_edge->edge_start_(((SdaiVertex
*)vertex_pnts->at(edge->Vertex(1)->m_vertex_index)));
oriented_edge->edge_end_(((SdaiVertex
*)vertex_pnts->at(edge->Vertex(0)->m_vertex_index)));
- std::cout << "Verts " << edge->Vertex(1)->m_vertex_index << "," <<
edge->Vertex(0)->m_vertex_index << "\n";
+ std::cout << "Verts " << edge->Vertex(1)->m_vertex_index << ", " <<
edge->Vertex(0)->m_vertex_index << "\n";
} else {
oriented_edge->edge_start_(((SdaiVertex
*)vertex_pnts->at(edge->Vertex(0)->m_vertex_index)));
oriented_edge->edge_end_(((SdaiVertex
*)vertex_pnts->at(edge->Vertex(1)->m_vertex_index)));
- std::cout << "Verts " << edge->Vertex(0)->m_vertex_index << "," <<
edge->Vertex(1)->m_vertex_index << "\n";
+ std::cout << "Verts " << edge->Vertex(0)->m_vertex_index << ", " <<
edge->Vertex(1)->m_vertex_index << "\n";
}
oriented_edge->orientation_((Boolean)!trim->m_bRev3d);
instance_list->Append(new_oriented_edge, completeSE);
@@ -244,6 +245,7 @@
return i;
}
+
STEPcomplex *
Add_Default_Geometric_Context(Registry *registry, InstMgr *instance_list)
{
@@ -368,8 +370,8 @@
instance_list->Append((STEPentity *)ua_entry_2, completeSE);
instance_cnt++;
- /*
- * Now that we have the pieces, build the final complex type from four
other types:
+ /*
+ * Now that we have the pieces, build the final complex type from four
other types:
*/
const char *entNmArr[5] = {"geometric_representation_context",
"global_uncertainty_assigned_context",
"global_unit_assigned_context",
"representation_context", "*"};
@@ -426,10 +428,13 @@
return complex_entity;
}
-/* Defining a shape is necessary for at least some systems, but how this is
done does not appear
- * to be at all uniform between the outputs from various systems. The
following hierarchies have
- * been seen so far - we'll initially follow Rhino's lead since we're using
openNURBs representations,
- * but different importers may prove to need other styles and it's something
to bear in mind.
+
+/* Defining a shape is necessary for at least some systems, but how
+ * this is done does not appear to be at all uniform between the
+ * outputs from various systems. The following hierarchies have been
+ * seen so far - we'll initially follow Rhino's lead since we're using
+ * openNURBs representations, but different importers may prove to
+ * need other styles and it's something to bear in mind.
*
* #1:
*
@@ -458,21 +463,31 @@
{
STEPentity *ret_entity =
registry->ObjCreate("SHAPE_REPRESENTATION_RELATIONSHIP");
instance_list->Append(ret_entity, completeSE);
+
SdaiShape_representation_relationship *shape_rep_rel =
(SdaiShape_representation_relationship *) ret_entity;
shape_rep_rel->name_("''");
shape_rep_rel->description_("''");
+
SdaiShape_representation *shape_rep = (SdaiShape_representation
*)registry->ObjCreate("SHAPE_REPRESENTATION");
instance_list->Append((STEPentity *)shape_rep, completeSE);
shape_rep_rel->rep_1_((SdaiRepresentation *)shape_rep);
shape_rep_rel->rep_2_(manifold_shape);
shape_rep->name_("''");
shape_rep->context_of_items_(context);
+
EntityAggregate *axis_items = shape_rep->items_();
+
+ /* create an axis */
+
SdaiAxis2_placement_3d *axis3d = (SdaiAxis2_placement_3d
*)registry->ObjCreate("AXIS2_PLACEMENT_3D");
instance_list->Append((STEPentity *)axis3d, completeSE);
axis3d->name_("''");
+
+ /* set the axis origin */
+
SdaiCartesian_point *origin= (SdaiCartesian_point
*)registry->ObjCreate("CARTESIAN_POINT");
instance_list->Append((STEPentity *)origin, completeSE);
+
RealNode *xnode = new RealNode();
xnode->value = 0.0;
RealNode *ynode= new RealNode();
@@ -484,8 +499,12 @@
origin->coordinates_()->AddNode(znode);
origin->name_("''");
axis3d->location_(origin);
+
+ /* set the axis up direction (i-vector) */
+
SdaiDirection *axis = (SdaiDirection *)registry->ObjCreate("DIRECTION");
instance_list->Append((STEPentity *)axis, completeSE);
+
RealNode *axis_xnode = new RealNode();
axis_xnode->value = 0.0;
RealNode *axis_ynode= new RealNode();
@@ -497,8 +516,12 @@
axis->direction_ratios_()->AddNode(axis_znode);
axis->name_("''");
axis3d->axis_(axis);
+
+ /* add the axis front direction (j-vector) */
+
SdaiDirection *ref_dir = (SdaiDirection *)registry->ObjCreate("DIRECTION");
instance_list->Append((STEPentity *)ref_dir, completeSE);
+
RealNode *ref_dir_xnode = new RealNode();
ref_dir_xnode->value = 1.0;
RealNode *ref_dir_ynode= new RealNode();
@@ -510,7 +533,11 @@
ref_dir->direction_ratios_()->AddNode(ref_dir_znode);
ref_dir->name_("''");
axis3d->ref_direction_(ref_dir);
+
+ /* add the axis to the shape definition */
+
axis_items->AddNode(new EntityNode((SDAI_Application_instance *)axis3d));
+
return ret_entity;
}
@@ -521,7 +548,9 @@
}
#endif
-bool ON_BRep_to_STEP(ON_Brep *brep, Registry *registry, InstMgr *instance_list)
+
+bool
+ON_BRep_to_STEP(ON_Brep *brep, Registry *registry, InstMgr *instance_list)
{
std::vector<STEPentity *> cartesian_pnts(brep->m_V.Count(), (STEPentity
*)0);
std::vector<STEPentity *> vertex_pnts(brep->m_V.Count(), (STEPentity *)0);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits