Revision: 57276
http://sourceforge.net/p/brlcad/code/57276
Author: starseeker
Date: 2013-08-29 20:24:02 +0000 (Thu, 29 Aug 2013)
Log Message:
-----------
Allow null edges, use the IsClosed test for surfaces
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-29 19:57:11 UTC
(rev 57275)
+++ brlcad/trunk/src/conv/step/g-step/ON_Brep.cpp 2013-08-29 20:24:02 UTC
(rev 57276)
@@ -228,69 +228,72 @@
ON_BrepEdge *edge = trim->Edge();
int i = -1;
- // handle closed loop edges a little differently
- if (edge && edge->EdgeCurveOf()->IsClosed() && info->split_closed) {
- std::map<int, std::pair<STEPentity *, STEPentity *> >::iterator it;
- std::map<int, STEPentity * >::iterator v_it;
+ // Some trims don't have an associated edge - allow for that
+ if (edge) {
+ // handle closed loop edges a little differently
+ if (edge->EdgeCurveOf()->IsClosed() && info->split_closed) {
+ std::map<int, std::pair<STEPentity *, STEPentity *> >::iterator it;
+ std::map<int, STEPentity * >::iterator v_it;
- it = info->sdai_e_curve_to_splits.find(edge->EdgeCurveIndexOf());
- v_it = info->split_midpt_vertex.find(edge->EdgeCurveIndexOf());
+ it = info->sdai_e_curve_to_splits.find(edge->EdgeCurveIndexOf());
+ v_it = info->split_midpt_vertex.find(edge->EdgeCurveIndexOf());
- SdaiOriented_edge *left_edge = (SdaiOriented_edge
*)info->registry->ObjCreate("ORIENTED_EDGE");
- left_edge->name_("''");
- SdaiOriented_edge *right_edge = (SdaiOriented_edge
*)info->registry->ObjCreate("ORIENTED_EDGE");
- right_edge->name_("''");
+ SdaiOriented_edge *left_edge = (SdaiOriented_edge
*)info->registry->ObjCreate("ORIENTED_EDGE");
+ left_edge->name_("''");
+ SdaiOriented_edge *right_edge = (SdaiOriented_edge
*)info->registry->ObjCreate("ORIENTED_EDGE");
+ right_edge->name_("''");
- if (trim->m_bRev3d) {
- left_edge->edge_element_((SdaiEdge *)(it->second.second));
- right_edge->edge_element_((SdaiEdge *)(it->second.first));
- left_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
- right_edge->edge_start_((SdaiVertex *)v_it->second);
- left_edge->edge_end_((SdaiVertex *)v_it->second);
- right_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
- } else {
- left_edge->edge_element_((SdaiEdge *)(it->second.first));
- right_edge->edge_element_((SdaiEdge *)(it->second.second));
- left_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
- right_edge->edge_start_((SdaiVertex *)(v_it->second));
- left_edge->edge_end_((SdaiVertex *)(v_it->second));
- right_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
- }
+ if (trim->m_bRev3d) {
+ left_edge->edge_element_((SdaiEdge *)(it->second.second));
+ right_edge->edge_element_((SdaiEdge *)(it->second.first));
+ left_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
+ right_edge->edge_start_((SdaiVertex *)v_it->second);
+ left_edge->edge_end_((SdaiVertex *)v_it->second);
+ right_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
+ } else {
+ left_edge->edge_element_((SdaiEdge *)(it->second.first));
+ right_edge->edge_element_((SdaiEdge *)(it->second.second));
+ left_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
+ right_edge->edge_start_((SdaiVertex *)(v_it->second));
+ left_edge->edge_end_((SdaiVertex *)(v_it->second));
+ right_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
+ }
- // add the left edge
- left_edge->orientation_((Boolean)!trim->m_bRev3d);
- info->oriented_edges.push_back((STEPentity *)left_edge);
- i = info->oriented_edges.size() - 1;
- e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
+ // add the left edge
+ left_edge->orientation_((Boolean)!trim->m_bRev3d);
+ info->oriented_edges.push_back((STEPentity *)left_edge);
+ i = info->oriented_edges.size() - 1;
+ e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
- // add the right edge
- right_edge->orientation_((Boolean)!trim->m_bRev3d);
- info->oriented_edges.push_back((STEPentity *)right_edge);
- i = info->oriented_edges.size() - 1;
- e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
+ // add the right edge
+ right_edge->orientation_((Boolean)!trim->m_bRev3d);
+ info->oriented_edges.push_back((STEPentity *)right_edge);
+ i = info->oriented_edges.size() - 1;
+ e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
- } else {
- STEPentity *new_oriented_edge =
info->registry->ObjCreate("ORIENTED_EDGE");
- SdaiOriented_edge *oriented_edge = (SdaiOriented_edge
*)new_oriented_edge;
- SdaiEdge_curve *e_curve = (SdaiEdge_curve
*)info->edge_curves.at(edge->EdgeCurveIndexOf());
+ } else {
+ STEPentity *new_oriented_edge =
info->registry->ObjCreate("ORIENTED_EDGE");
+ SdaiOriented_edge *oriented_edge = (SdaiOriented_edge
*)new_oriented_edge;
+ SdaiEdge_curve *e_curve = (SdaiEdge_curve
*)info->edge_curves.at(edge->EdgeCurveIndexOf());
- oriented_edge->name_("''");
- oriented_edge->edge_element_((SdaiEdge *)e_curve);
+ oriented_edge->name_("''");
+ oriented_edge->edge_element_((SdaiEdge *)e_curve);
- if (trim->m_bRev3d) {
- oriented_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
- oriented_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
- } else {
- oriented_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
- oriented_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
+ if (trim->m_bRev3d) {
+ oriented_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
+ oriented_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
+ } else {
+ oriented_edge->edge_start_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(0)->m_vertex_index)));
+ oriented_edge->edge_end_(((SdaiVertex
*)info->vertex_pnts.at(edge->Vertex(1)->m_vertex_index)));
+ }
+
+ // add the edge
+ oriented_edge->orientation_((Boolean)!trim->m_bRev3d);
+ info->oriented_edges.push_back(new_oriented_edge);
+ i = info->oriented_edges.size() - 1;
+ e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
}
-
- // add the edge
- oriented_edge->orientation_((Boolean)!trim->m_bRev3d);
- info->oriented_edges.push_back(new_oriented_edge);
- i = info->oriented_edges.size() - 1;
- e_loop_path->edge_list_()->AddNode(new
EntityNode((SDAI_Application_instance *)(info->oriented_edges.at(i))));
}
}
@@ -1056,9 +1059,8 @@
curr_surface->surface_form_(B_spline_surface_form__unspecified);
/* TODO - for now, assume the surfaces don't self-intersect - need
to figure out how to test this */
curr_surface->self_intersect_(LFalse);
- /* TODO - need to recognize when these should be true */
- curr_surface->u_closed_(LFalse);
- curr_surface->v_closed_(LFalse);
+ curr_surface->u_closed_((Logical)n_surface->IsClosed(0));
+ curr_surface->v_closed_((Logical)n_surface->IsClosed(1));
surface_converted = 1;
}
@@ -1084,9 +1086,8 @@
curr_surface->surface_form_(B_spline_surface_form__plane_surf);
/* TODO - for now, assume non-self-intersecting */
curr_surface->self_intersect_(LFalse);
- /* TODO - need to recognize when these should be true */
- curr_surface->u_closed_(LFalse);
- curr_surface->v_closed_(LFalse);
+ curr_surface->u_closed_((Logical)sum_nurb.IsClosed(0));
+ curr_surface->v_closed_((Logical)sum_nurb.IsClosed(1));
surface_converted = 1;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits