cgma
|
Interface class for modifying geometry. More...
#include <GeometryModifyTool.hpp>
Public Member Functions | |
~GeometryModifyTool () | |
Destructor. | |
Body * | sphere (double radius, int x_shift=0, int y_shift=0, int z_shift=0, double inner_radius=0, bool delete_side=false) |
Creates a sphere. | |
Body * | brick (double wid, double dep, double hi) |
Creates a brick (cube). | |
Body * | brick (const CubitVector ¢er, const CubitVector axes[3], const CubitVector &extension) |
Creates a brick (cube). | |
Body * | prism (double height, int sides, double major, double minor) |
Creates a brick (cube). | |
Body * | pyramid (double height, int sides, double major, double minor, double top=0.0) |
Creates a pyramid. | |
Body * | cylinder (double hi, double r1, double r2, double r3) |
Creates a clyinder. | |
Body * | torus (double r1, double r2) |
Creates a torus. | |
Body * | planar_sheet (const CubitVector &p1, const CubitVector &p2, const CubitVector &p3, const CubitVector &p4) |
Creates a planar surface from using four vertices. | |
Body * | planar_sheet (const CubitVector ¢er, const CubitVector axes[2], double width, double height) |
Creates a surface from using four vertices. | |
Body * | planar_sheet (const CubitPlane &plane, const CubitBox &bounding_box, int extension_type=0, double extension=0.0) |
Creates a surface from a plane and bounding box. | |
Body * | create_body (VolumeFacets &volume, std::map< FacetShapes *, RefEntity * > &entity_map, const FacetPointSet &points, int interp_order) |
Creates a volume from facet data. | |
CubitStatus | scale (Body *&entity, const CubitVector &point, const CubitVector &factors, bool check_to_transform=true, bool preview=false, bool reset_preview=true) |
Scale a body non-uniformly. (x,y,z directions) | |
Body * | copy_body (Body *body_ptr, std::map< RefEntity *, RefEntity * > *old_to_new_map=NULL) |
Copy a Body. | |
RefEntity * | copy_refentity (RefEntity *old_entity) |
Copy a RefEntity. | |
CubitStatus | reverse (DLIList< Body * > &body_list) |
Turn bodies inside-out. | |
CubitStatus | reverse (DLIList< RefFace * > &ref_face_list) |
Reverse the given faces using the solid modeller (flip normals) | |
CubitStatus | align_entities (RefFace *my_face, RefFace *target_face, DLIList< RefEntity * > &entities_to_move, bool reverse, CubitVector &my_center, CubitVector &axis_of_rot, CubitVector &target_center, double &angle, bool preview) |
Compute the transformation required to align my_face with target_face with respect to reference_body_ptr. Then perform the transformation on all entities in entities_to_move. | |
CubitStatus | align_entities (DLIList< RefEntity * > &entities_to_move, CubitVector &position_to_align, CubitVector &position_to_align_to, CubitVector &axis_origin, CubitVector &axis_of_rot, double &angle_of_rotation, bool preview) |
Aligns entities by rotating about them about axis from one point to another. | |
CubitStatus | align_entities (DLIList< RefEntity * > &reference_entities, DLIList< RefEntity * > &entities_to_move, CubitVector align_to_vec, CubitVector &my_center, CubitVector &axis_of_rot, double &angle, bool preview) |
Aligns a the normal of a surface or a line to a plane. | |
CubitStatus | chop (DLIList< Body * > &bodies, DLIList< Body * > &intersectBodies, DLIList< Body * > &outsideBodies, Body *&leftoversBody, bool keep_old=false, bool nonreg=false) |
Intersects and subtracts the two bodies in the list. | |
CubitStatus | hollow (DLIList< Body * > &bodies, DLIList< RefFace * > faces_to_remove, DLIList< Body * > &new_bodies, double depth) |
CubitStatus | thicken (DLIList< Body * > &bodies, DLIList< Body * > &new_bodies, double depth, bool both=false) |
Thickens a sheet body (surface) into a solid body. Can do both directions. | |
CubitStatus | unite (DLIList< Body * > &bodies, DLIList< Body * > &newBodies, bool keep_old=false) |
Boolean unite. | |
CubitStatus | unite (DLIList< BodySM * > &body_sm_list, DLIList< BodySM * > &new_body_sm_list, bool keep_old=false) |
Boolean unite. | |
CubitStatus | subtract (DLIList< Body * > &tool_body_list, DLIList< Body * > &from_bodies, DLIList< Body * > &new_bodies, bool imprint=false, bool keep_old=false) |
Boolean subtract. | |
CubitStatus | subtract (Body *tool_body, DLIList< Body * > &from_bodies, DLIList< Body * > &new_bodies, bool imprint=false, bool keep_old=false) |
Boolean subtract. Subtracts the tool from all the blanks. | |
CubitStatus | validate_normals (DLIList< Body * > &bodies, RefFace *surf_ref, bool reverse) |
Checks for consistent normals across body. Uses surf_ref as a reference surface. All other surfaces in volume should have normal point in likewise direction (in or out of volume). | |
CubitStatus | intersect (Body *tool_body_ptr, DLIList< Body * > &from_bodies, DLIList< Body * > &new_bodies, bool keep_old=false, bool preview=false) |
Boolean intersect. | |
CubitStatus | intersect (DLIList< Body * > &from_bodies, DLIList< Body * > &new_bodies, bool keep_old=false, bool preview=false) |
Boolean intersect. | |
CubitStatus | section (DLIList< Body * > §ion_body_list, const CubitVector &point_1, const CubitVector &point_2, const CubitVector &point_3, DLIList< Body * > &new_body_list, CubitBoolean keep_normal_side, CubitBoolean keep_old=CUBIT_FALSE) |
Cuts body with plane, throwing away one side. | |
CubitStatus | split_periodic (Body *body_ptr, Body *&new_body_ptr) |
Splits periodic curves and surfaces. | |
CubitStatus | stitch (DLIList< Body * > &bodies_to_stitch, DLIList< Body * > &result_list, bool tighten_gaps, double tolerance=-1.0) |
Stitches sheet bodies at common edges to form larger sheet body or solid. | |
CubitStatus | discover_topology (RefFace *ref_face_ptr, CubitVector &pos, double &step_size, int num_subdivisions) |
Beta function. | |
CubitStatus | imprint_and_merge_curves (RefEdge *curve1, RefEdge *curve2, DLIList< RefVertex * > &vert_list, double divergence_angle, DLIList< DLIList< RefEdge * > * > &curves_to_merge1, DLIList< DLIList< RefEdge * > * > &curves_to_merge2, DLIList< DLIList< RefEdge * > * > &prev_curve_merge_lists, DLIList< DLIList< RefFace * > * > &prev_surf_merge_lists) |
void | march_path_to_discover_horizontal (CubitVector &start_pos, CubitVector &sweep_dir, RefFace *start_face, CubitVector &march_dir, double &step_size, DLIList< CubitVector > &final_points, DLIList< RefFace * > &ending_faces) |
Beta function. | |
void | march_path_to_discover_vertical (CubitVector &start_pos, CubitVector &sweep_dir, RefFace *start_face, CubitVector &march_dir, double &step_size, DLIList< CubitVector > &final_points, DLIList< RefFace * > &ending_faces) |
void | march_using_planes (CubitVector &point_on_surf, RefFace *surf, CubitVector &march_dir, double step_size, DLIList< CubitVector > &horizontal_points, DLIList< CubitVector > &vertical_points) |
void | trace_out_curves (Body *plane_body, CubitVector &start_point, CubitVector &march_dir, double step_size, DLIList< CubitVector > &horizontal_points, DLIList< CubitVector > &vertical_points) |
void | subdivide_pie (CubitVector &dir1, CubitVector &dir2, int num_subdivisions, DLIList< CubitVector > &all_directions) |
Beta function. | |
CubitStatus | split_surface (RefFace *ref_face_ptr, DLIList< CubitVector * > &locations, DLIList< DLIList< CubitVector * > * > &vec_lists, CubitBoolean preview_flg=CUBIT_FALSE, CubitBoolean create_ref_edges_flg=CUBIT_FALSE, CubitBoolean clear_previous_previews=CUBIT_TRUE) |
Splits a surface with a curve defined by positions. | |
CubitStatus | split_surface (DLIList< RefFace * > &ref_face_list, DLIList< CubitVector * > &locations, DLIList< DLIList< DLIList< CubitVector * > * > * > &list_of_vec_lists, CubitBoolean preview_flg=CUBIT_FALSE, CubitBoolean create_ref_edges_flg=CUBIT_FALSE, CubitBoolean clear_previous_previews=CUBIT_TRUE) |
Splits MULTIPLE surfaces with a curves defined by positions. | |
CubitStatus | split_surfaces_extend (DLIList< RefFace * > &ref_face_list, DLIList< RefVertex * > &ref_vertex_list, CubitBoolean preview_flg=CUBIT_FALSE, CubitBoolean create_ref_edges_flg=CUBIT_FALSE) |
Splits surfaces by extending curves at the end of hardlines across the surface. | |
CubitStatus | split_surfaces (DLIList< RefFace * > &ref_face_list, int num_segs, double fraction, double distance, RefEdge *from_curve_ptr, DLIList< RefVertex * > &corner_vertex_list, DLIList< RefVertex * > &through_vertex_list, RefEdge *curve_dir_ptr=NULL, CubitBoolean preview_flg=CUBIT_FALSE, CubitBoolean create_ref_edges_flg=CUBIT_FALSE) |
Splits a surface or connected set of surfaces in one direction. | |
CubitStatus | split_surfaces_offset (DLIList< RefFace * > &ref_face_list, DLIList< RefEdge * > &edge_list, int num_segs, double distance, CubitBoolean partition_flg=CUBIT_FALSE, CubitBoolean blunt_flg=CUBIT_FALSE, CubitBoolean preview_flg=CUBIT_FALSE, CubitBoolean create_ref_edges_flg=CUBIT_FALSE) |
Splits surfaces a specified distance from curves. | |
CubitStatus | auto_mid_surface (DLIList< Body * > &body_list_in, DLIList< Body * > &body_list_out, DLIList< Body * > &old_bodies_midsurfaced, DLIList< double > &thickness_list, double lower_tol, double upper_tol, CubitBoolean delete_midsurfaced, CubitBoolean preview) |
Create a midsurface from a volume. | |
CubitStatus | webcut_with_cylinder (DLIList< Body * > &webcut_body_list, double radius, const CubitVector &axis, const CubitVector ¢er, DLIList< Body * > &results_list, DLIList< Body * > &neighboring_bodies, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a cylinder. | |
CubitStatus | webcut_with_Cone (DLIList< Body * > &webcut_body_list, DLIList< BodySM * > &webcut_bodySM_list, double outer_radius, double top_radius, CubitVector &Axispt1, CubitVector &Axispt2, DLIList< Body * > &results_list, DLIList< Body * > &neighboring_bodies, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a cone. | |
CubitStatus | webcut_with_brick (DLIList< Body * > &webcut_body_list, const CubitVector ¢er, const CubitVector axes[3], const CubitVector &extension, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a brick (cube). | |
CubitStatus | webcut_with_planar_sheet (DLIList< Body * > &webcut_body_list, const CubitVector ¢er, const CubitVector axes[2], double width, double height, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a planar sheet. | |
CubitStatus | webcut_with_plane (DLIList< Body * > &webcut_body_list, const CubitVector &vector1, const CubitVector &vector2, const CubitVector &vector3, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a plane. | |
CubitStatus | webcut_with_surface (DLIList< Body * > &webcut_body_list, RefFace *refFace, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a surface -- must be planar. | |
CubitStatus | webcut_with_curve_loop (DLIList< Body * > &webcut_body_list, DLIList< RefEdge * > &refedge_list, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a surface defined by a curve loop. | |
CubitStatus | webcut_with_sheet (DLIList< Body * > &webcut_body_list, Body *sheet_body, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcut bodies using a surface, need to be planar. | |
CubitStatus | webcut_with_body (DLIList< Body * > &webcut_body_list, Body *body, DLIList< Body * > &results_list, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies with a tool body. | |
CubitStatus | webcut_with_extended_sheet (DLIList< Body * > &webcut_body_list, DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, int &num_cut, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Webcuts bodies by with an extended surface(s). | |
CubitStatus | webcut_with_sweep_surfaces_rotated (DLIList< Body * > &webcut_body_list, DLIList< RefFace * > &tool_faces, CubitVector &point, CubitVector &sweep_axis, double angle, RefFace *stop_surf, bool up_to_next, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=false, CubitBoolean preview=false) |
Webcuts bodies with a tool solid created by rotating surfaces about an axis. | |
CubitStatus | webcut_with_sweep_curves_rotated (DLIList< Body * > &webcut_body_list, DLIList< RefEdge * > &tool_curves, CubitVector &point, CubitVector &sweep_axis, double angle, RefFace *stop_surf, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=false, CubitBoolean preview=false) |
Webcuts bodies with a tool surface created by rotating curves about an axis. | |
CubitStatus | webcut_with_sweep_surfaces (DLIList< Body * > &webcut_body_list, DLIList< RefFace * > &tool_faces, const CubitVector sweep_vector, bool sweep_perp, bool through_all, bool outward, bool up_to_next, RefFace *stop_surf, RefEdge *edge_to_sweep_along, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=false, CubitBoolean preview=false) |
Webcuts bodies with a tool solid created by sweeping surfaces along a vector. | |
CubitStatus | webcut_with_sweep_curves (DLIList< Body * > &webcut_body_list, DLIList< RefEdge * > &tool_curves, const CubitVector sweep_vector, bool through_all, RefFace *stop_surf, RefEdge *edge_to_sweep_along, DLIList< Body * > &new_bodies, DLIList< Body * > &neighbor_list, ImprintType imprint_type=NO_IMPRINT, CubitBoolean merge=false, CubitBoolean preview=false) |
Webcuts bodies with a tool surface created by sweeping curves along a vector. | |
CubitStatus | remove_topology (DLIList< RefEdge * > &ref_edge_list, DLIList< RefFace * > &ref_face_list, double backoff_distance, double small_curve_size, DLIList< Body * > &new_body_list, CubitBoolean propagate, CubitBoolean preview) |
Removes small topology; i.e, curves and surfaces. | |
CubitStatus | offset_curves (DLIList< RefEdge * > &ref_edge_list, DLIList< RefEdge * > &output_edge_list, double offset_distance, const CubitVector &offset_direction, int gap_type=1) |
Creates curves offset from a chain of curves. The offset direction is. | |
CubitStatus | trim_curve (RefEdge *trim_curve, const CubitVector &trim_vector, const CubitVector &keep_vector) |
Trims or extends a curve, up to the trim_vector. If trimming, the. | |
CubitStatus | imprint (DLIList< Body * > &from_body_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old=CUBIT_FALSE) |
Imprints a group of bodies with one another. | |
CubitStatus | imprint (DLIList< Body * > &body_list, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean show_messages=CUBIT_TRUE) |
Imprints a list of Bodies with a list of RefEdges. Useful for. | |
CubitStatus | imprint (DLIList< RefFace * > &ref_face_list, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE) |
Imprints a list of RefFaces with a list of RefEdges. This is. | |
CubitStatus | imprint (DLIList< Surface * > &surface_list, DLIList< DLIList< Curve * > * > &curve_lists_list, Body *&new_body, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean expand=CUBIT_TRUE) |
Imprints a list of Surfaces with list of Curves, sorted per. | |
CubitStatus | imprint (DLIList< Body * > &body_list, DLIList< CubitVector > &vector_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean merge=CUBIT_FALSE) |
Imprints a list of bodies to a list of locations. | |
CubitStatus | imprint_projected_edges (DLIList< RefFace * > &ref_face_list, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body, CubitBoolean keep_free_edges) |
Imprints a list of RefFaces with a list of projected RefEdges. | |
CubitStatus | imprint_projected_edges (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &body_list, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body, CubitBoolean keep_free_edges) |
Imprints a list of Bodies with a list of RefEdges which are projected to a list of RefFaces. | |
CubitStatus | tolerant_imprint (DLIList< RefFace * > &ref_faces, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_bodies, bool merge=false) |
Tolerantly imprintings a list of curves on a list of surfaces. Should be used when you have sloppy/out-of-tolerance geometry. | |
CubitStatus | tolerant_imprint (RefFace *ref_face, DLIList< RefEdge * > &ref_edge_list, Body *&new_body, bool merge=false) |
Tolerantly imprintings a list of curves onto a single surface. Should be used when you have sloppy/out-of-tolerance geometry. | |
CubitStatus | tolerant_imprint (DLIList< Body * > &bodies, DLIList< Body * > &new_bodies, double overlap_tol, double imprint_tol, bool merge=false) |
Imprints bodies onto one another. Should be used when you have sloppy/out- of-tolerance geometry. | |
CubitStatus | project_edges (DLIList< RefFace * > &ref_face_list, DLIList< RefEdge * > &ref_edge_list_in, DLIList< RefEdge * > &ref_edge_list_new, CubitBoolean trim_projected=CUBIT_FALSE) |
Projects list RefEdges onto a list of RefFaces. | |
CubitStatus | regularize_body (Body *body_ptr, Body *&new_body) |
Removes all unnessesary faces, curves, vertices from a body. | |
CubitStatus | regularize_refentity (RefEntity *old_entity_ptr, Body *&new_body_ptr) |
Removes all unnessesary faces, curves, vertices and associated data from a refentity. | |
CubitStatus | test_regularize_refentity (RefEntity *old_entity_ptr) |
Tests if a RefEntity can have any unncessary child entities removed, or simplified away. | |
CubitStatus | split_free_curve (RefEdge *ref_edge, DLIList< CubitVector > &split_locations, DLIList< RefEdge * > &new_ref_edges) |
CubitStatus | split_body (Body *body_ptr, DLIList< Body * > &new_bodies) const |
Separates multi-volume bodies into single-volume bodies. | |
CubitStatus | separate_surfaces (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_bodies) |
Separates surfaces from sheet bodies into separate bodies. Connected. | |
double | get_resultant_angle_score (RefFace *narrow_face, RefFace *other_face, RefEdge *common_edge) |
double | get_neighbor_type_score (RefEdge *common_edge, RefFace *other_face, double small_curve_size, int &neighbor_is_narrow_or_small) |
double | get_dihedral_angle_score (RefFace *f1, RefFace *f2, RefEdge *common_edge) |
double | get_edge_type_score (RefEdge *common_edge, double small_curve_size) |
double | get_diff_from_multiple_of_90 (double angle) |
void | split_surface_with_narrow_region (RefFace *face, DLIList< CubitVector > &split_pos1_list, DLIList< CubitVector > &split_pos2_list) |
RefVertex * | make_RefVertex (CubitVector const &point, int color=CUBIT_DEFAULT_COLOR_INDEX) const |
Creates a point from an x,y,z location. | |
RefVertex * | make_RefVertex (RefVertex *vertex) const |
Body * | make_Body (Surface *surface) const |
Creates a sheet body from a surface. | |
RefEdge * | make_RefEdge (GeometryType ref_edge_type, RefVertex *ref_vertex_1, RefVertex *ref_vertex_2, DLIList< CubitVector * > &vector_list, RefFace *reffaca_ptr=NULL) const |
Creates a curve from two or more points. | |
RefEdge * | make_RefEdge (RefVertex *ref_vertex_1, RefVertex *ref_vertex_2, RefFace *ref_face_ptr, RefVertex const *ref_vertex_3=NULL) const |
Creates a curve from two or more points, on a surface. | |
RefEdge * | make_RefEdge (RefEdge *ref_edge, bool copy_attribs=true, std::map< RefEntity *, RefEntity * > *old_to_new_map=NULL) const |
Create a curve from an existing curve. | |
RefEdge * | make_RefEdge (GeometryType ref_edge_type, RefVertex *ref_vertex_1, RefVertex *ref_vertex_2, CubitVector const *intermediate_point=NULL) const |
Create a curve, i.e. ellipse, parabola, straight, or arc curves. | |
RefEdge * | make_elliptical_RefEdge (RefVertex *vert1, RefVertex *vert2, CubitVector center_point, double start_angle, double end_angle, CubitSense sense) const |
RefFace * | make_RefFace (RefFace *from_ref_face, std::map< RefEntity *, RefEntity * > *old_to_new_map=NULL) const |
Create a surface from an existing one. | |
Body * | make_extended_sheet (DLIList< RefFace * > &ref_face_list, CubitBox *clip_box_ptr=NULL, bool preview=false) const |
This function creates a sheet body by extending the input surfaces. | |
RefFace * | make_RefFace (GeometryType ref_face_type, DLIList< RefEdge * > &ref_edge_list, bool is_free_face, RefFace *ref_face_ptr=NULL, bool check_edges=true) const |
Creates a surface from bounding curves. | |
Body * | make_Body (DLIList< RefVolume * > &ref_volume_list) const |
Creates a body from a list of volumes. | |
Body * | make_Body (RefFace *from_ref_face, std::map< RefEntity *, RefEntity * > *old_to_new_map=NULL) const |
Creates a body from a surface. | |
Body * | make_Body (GeometryType ref_face_type, DLIList< RefEdge * > &ref_edge_list, RefFace *ref_face_ptr=NULL) const |
Creates a body from a surface created from a list of curves. | |
CubitStatus | sweep_translational (DLIList< RefEntity * > &ref_ent_list, const CubitVector &sweep_vector, double draft_angle, int draft_type, CubitBoolean switchside, CubitBoolean rigid, CubitBoolean anchor_entity, CubitBoolean keep_old, DLIList< Body * > &output_body_list) |
Create bodies by sweeping curves or surfaces along a vector. | |
CubitStatus | sweep_helical (DLIList< RefEntity * > &ref_ent_list, CubitVector &location, CubitVector &direction, double &thread_distance, double &angle, bool right_handed, CubitBoolean anchor_entity, CubitBoolean keep_old, DLIList< Body * > &output_body_list) |
CubitStatus | sweep_curve_target (CubitPlane ref_plane, DLIList< RefEntity * > &ref_ent_list) |
CubitStatus | sweep_curve_target (DLIList< RefEdge * > &curve_list, Body *target_body, DLIList< Body * > &out_bodies, CubitVector direction, CubitPlane stop_plane, bool unite) |
CubitStatus | sweep_surface_target (RefFace *face, Body *target_body, CubitVector distance, CubitPlane stop_plane, double magnitude=0.0) |
CubitStatus | sweep_surface_target (CubitPlane ref_plane, DLIList< RefEntity * > &ref_ent_list) |
CubitStatus | sweep_perpendicular (DLIList< RefEntity * > &ref_ent_list, double distance, double draft_angle, int draft_type, CubitBoolean switchside, CubitBoolean rigid, CubitBoolean anchor_entity, CubitBoolean keep_old, DLIList< Body * > &output_body_list) |
CubitStatus | sweep_rotational (DLIList< RefEntity * > &ref_ent_list, const CubitVector &point, const CubitVector &direction, double angle, DLIList< Body * > &output_body_list, CubitBoolean anchor_entity, CubitBoolean keep_old, int steps=0, double draft_angle=0.0, int draft_type=0, CubitBoolean switchside=CUBIT_FALSE, CubitBoolean make_solid=CUBIT_FALSE, CubitBoolean rigid=CUBIT_FALSE) |
Creates bodies by sweeping surfaces or curves about an axis. | |
CubitStatus | sweep_along_curve (DLIList< RefEntity * > &ref_ent_list, DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &output_body_list, CubitBoolean anchor_entity, CubitBoolean keep_old, double draft_angle=0.0, int draft_type=0, CubitBoolean rigid=CUBIT_FALSE) |
Creates bodies by sweeping surfaces or curves along a curve. | |
CubitStatus | tweak_bend (DLIList< Body * > &bend_bodies, DLIList< Body * > &new_body_list, CubitVector &neutral_root, CubitVector &bend_axis, CubitVector &bend_direction, double radius, double angle, DLIList< CubitVector > &bend_regions, double width=-1, CubitBoolean center_bend=CUBIT_FALSE, int num_points=0, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Currently unsupported. | |
CubitStatus | tweak_chamfer (DLIList< RefEdge * > &ref_edge_list, double left_offset, DLIList< Body * > &new_body_list, double right_offset=-1.0, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Chamfer curves on solid and sheet bodies. | |
CubitStatus | tweak_chamfer (DLIList< RefVertex * > &ref_vertex_list, double offset1, DLIList< Body * > &new_body_list, RefEdge *edge1=NULL, double offset2=-1.0, RefEdge *edge2=NULL, double offset3=-1.0, RefEdge *edge3=NULL, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Chamfer vertices on solid or sheet bodies. | |
CubitStatus | tweak_fillet (DLIList< RefEdge * > &ref_edge_list, double radius, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Creates a round fillet (or blend) at the given curves on solid or sheet bodies. | |
CubitStatus | tweak_fillet (RefEdge *ref_edge_ptr, double start_radius, double end_radius, Body *&new_body_ptr, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Creates a round fillet (or blend) at the given curve. | |
CubitStatus | tweak_fillet (DLIList< RefVertex * > &ref_vertex_list, double radius, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Create a round fillet (or blend) at the given vertices on sheet bodies. | |
CubitStatus | tweak_move (DLIList< RefFace * > &ref_face_list, const CubitVector &delta, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Tweak specified faces of a volume or volumes along a vector. | |
CubitStatus | tweak_move (DLIList< RefEdge * > &ref_edge_list, const CubitVector &delta, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Tweak specified curves of a sheet body along a vector. | |
CubitStatus | tweak_offset (DLIList< RefFace * > &ref_face_list, double offset_distance, DLIList< RefFace * > *add_ref_face_list_ptr, DLIList< double > *add_offset_list_ptr, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Offsets a surface(s) on a volume(s). | |
CubitStatus | tweak_offset (DLIList< RefEdge * > &ref_edge_list, double offset_distance, DLIList< RefEdge * > *add_ref_face_list_ptr, DLIList< double > *add_offset_list_ptr, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Offset curves on sheet bodies. | |
CubitStatus | tweak_remove_individually (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_body_list, CubitBoolean keep_surface=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Performs tweak_remove operation on surfaces individually. | |
CubitStatus | tweak_remove_together (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_body_list, CubitBoolean extend_adjoining=CUBIT_TRUE, CubitBoolean keep_surface=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Performs tweak_remove operation on surfaces collectively. | |
CubitStatus | tweak_remove (DLIList< RefEdge * > &ref_edge_list, DLIList< Body * > &new_body_list, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Removes a surface from a volume, extending neighboring surfaces. | |
CubitStatus | tweak_target (DLIList< RefFace * > &ref_face_list, DLIList< RefFace * > &target_face_list, DLIList< Body * > &new_body_list, CubitBoolean extend_flg=CUBIT_TRUE, CubitPlane *limit_plane=NULL, CubitBoolean reverse_flg=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Extends (tweaks) surfaces up to a target surface. | |
CubitStatus | tweak_target (DLIList< RefFace * > &ref_face_list, CubitPlane &plane, DLIList< Body * > &new_body_list, CubitBoolean reverse_flg=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Extends (tweaks) surfaces up to a target plane. | |
CubitStatus | tweak_target (DLIList< RefEdge * > &ref_edge_list, DLIList< RefFace * > &target_face_list, DLIList< Body * > &new_body_list, CubitBoolean extend_flg=CUBIT_TRUE, CubitPlane *limit_plane=NULL, CubitBoolean reverse_flg=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE, double max_area_increase=0) |
Extends (tweaks) curves up to a target surface. | |
CubitStatus | tweak_target (DLIList< RefEdge * > &ref_edge_list, CubitPlane &plane, DLIList< Body * > &new_body_list, CubitBoolean reverse_flg=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
CubitStatus | tweak_target (DLIList< RefEdge * > &ref_edge_list, DLIList< RefEdge * > &target_edge_list, DLIList< Body * > &new_body_list, CubitBoolean extend_flg=CUBIT_TRUE, CubitPlane *limit_plane=NULL, CubitBoolean reverse_flg=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE, double max_area_increase=0) |
Extends (tweaks) curves up to a target plane. | |
CubitStatus | tweak_target (RefVertex *ref_vertex_ptr, DLIList< RefFace * > &modify_ref_face_list, CubitVector &target_loc, Body *&new_Body_ptr, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Tweak specified vertex of a sheet body to a given location. | |
CubitStatus | remove_curve_slivers (DLIList< Body * > &bodies, double lengthlimit) |
Converts edges smaller than 'lengthlimit' into tolerant (or fat) vertices. only. | |
CubitStatus | create_net_surface (DLIList< Surface * > &ref_face_list, BodySM *&new_body, DLIList< DLIList< CubitVector * > * > &vec_lists_u, DLIList< DLIList< CubitVector * > * > &vec_lists_v, double net_tol=1e-3, CubitBoolean heal=CUBIT_TRUE) |
Create a surface using arrays of points in u and v directions. | |
CubitStatus | create_net_surface (DLIList< RefEdge * > &u_curves, DLIList< RefEdge * > &v_curves, double net_tol=1e-3, CubitBoolean heal=CUBIT_TRUE) |
Create a surface using curves in u and v directions. | |
CubitStatus | create_offset_surface (RefFace *ref_face_ptr, double offset_distance) |
Creates an offset surface some distance from a surface. | |
CubitStatus | create_offset_sheet (DLIList< RefFace * > &ref_face_list, double offset_distance, DLIList< RefFace * > *add_ref_face_list_ptr, DLIList< double > *add_offset_list_ptr, DLIList< Body * > &new_body_list, CubitBoolean preview=CUBIT_FALSE) |
Create a body(s) by offsetting the given surfaces. | |
CubitStatus | create_offset_body (Body *body_ptr, Body *&new_body, double offset_distance) |
Create a body by offsetting all the surface of the body. | |
CubitStatus | create_skin_surface (DLIList< RefEdge * > &ref_edges, Body *&new_body, DLIList< RefEdge * > &guides) |
Create a sheet body skinning (lofting) a series of curves. | |
CubitStatus | loft_surfaces_to_body (DLIList< RefFace * > &surfaces, DLIList< double > &takeoff_factor_list, DLIList< RefFace * > &takeoff_vector_surface_list, DLIList< CubitVector > &surface_takeoff_vector_list, DLIList< RefEdge * > &takeoff_vector_curve_list, DLIList< CubitVector > &curve_takeoff_vector_list, DLIList< RefEdge * > &guides, DLIList< RefVertex * > &match_vertices_list, Body *&new_body, CubitBoolean global_guides, CubitBoolean closed, CubitBoolean show_matching_curves, CubitBoolean preview) |
CubitStatus | create_surface_curve (DLIList< RefEntity * > curve_entity, DLIList< RefEntity * > target_entity, CubitVector sweep_direction=CubitVector(0, 0, 0), CubitBoolean distance_flag=CUBIT_FALSE) |
Body * | create_rectangle_surface (double width, double height, CubitVector plane) |
Body * | create_parallelogram_surface (RefVertex *v1, RefVertex *v2, RefVertex *v3) |
Body * | create_circle_surface (double radius, CubitVector plane) |
Body * | create_circle_surface (RefVertex *v1, RefVertex *v2, RefVertex *v3) |
Body * | create_circle_surface (RefVertex *v1, RefVertex *v2, CubitVector center_point) |
Body * | create_ellipse_surface (RefVertex *v1, RefVertex *v2, CubitVector center_point) |
Body * | create_ellipse_surface (double major_radius, double minor_radius, CubitVector plane) |
CubitStatus | idealize_hole_slot_geometry (DLIList< RefEntity * > idealize_entity, DLIList< RefEntity * > exclude_entity, double arc_radius, double slot_arc_radius, double slot_length, CubitBoolean preview=CUBIT_FALSE) |
CubitStatus | idealize_fillet_geometry (DLIList< RefEntity * > idealize_entity, DLIList< RefEntity * > exclude_entity, double fillet_rad, CubitBoolean internal_flg, CubitBoolean external_flg, CubitBoolean preview=CUBIT_FALSE) |
CubitStatus | create_surface_doubler (DLIList< RefEntity * > doubler_entity, DLIList< RefEntity * > target_entity, DLIList< Body * > &body_list_out, CubitBoolean internal_flg=CUBIT_FALSE, CubitBoolean extend_flg=CUBIT_TRUE, CubitPlane *limit_plane=NULL, CubitVector sweep_direction=CubitVector(0, 0, 0), CubitBoolean preview=CUBIT_FALSE) |
CubitStatus | create_surface (DLIList< CubitVector * > &vec_list, Body *&new_body, RefFace *ref_face_ptr, CubitBoolean project_points) |
Fits an analytic spline surface through positions. | |
CubitStatus | create_surface (DLIList< RefVertex * > &vert_list, Body *&new_body, RefFace *on_surface=NULL) |
CubitStatus | create_weld_surface (CubitVector &root, RefFace *ref_face1, double leg1, RefFace *ref_face2, double leg2, Body *&new_body) |
Creates a simple triangular weld surface. | |
CubitStatus | create_solid_bodies_from_surfs (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_bodies, CubitBoolean keep_old=CUBIT_FALSE, CubitBoolean heal=CUBIT_TRUE, CubitBoolean sheet=CUBIT_FALSE) const |
Creates a body out of the specified surfaces. | |
CubitStatus | surface_intersection (RefFace *ref_face1, RefFace *ref_face2, DLIList< RefEdge * > &ref_edge_list) |
Create curves from the intersection of two surfaces. | |
RefEdge * | create_arc (const CubitVector &position, double radius, double start_angle, double end_angle, CubitVector plane, CubitBoolean preview=CUBIT_FALSE) |
RefEdge * | create_arc_radius (RefVertex *ref_vertex1, RefVertex *ref_vertex2, const CubitVector &normal, double radius, CubitBoolean other_arc=CUBIT_FALSE, CubitBoolean full=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
RefEdge * | create_arc_three (RefVertex *ref_vertex1, RefVertex *ref_vertex2, RefVertex *ref_vertex3, CubitBoolean full=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Create an arc curve from three points. | |
RefEdge * | create_arc_three (RefEdge *ref_edge1, RefEdge *ref_edge2, RefEdge *ref_edge3, CubitBoolean full=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Create an arc curve tangent to three curves. | |
RefEdge * | create_arc_center_edge (RefVertex *ref_vertex1, RefVertex *ref_vertex2, RefVertex *ref_vertex3, const CubitVector &normal, double radius=CUBIT_DBL_MAX, CubitBoolean full=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
Create an arc curve from two points and a center point. If full option is specified, a full circle is created. | |
CubitStatus | create_curve_combine (DLIList< RefEdge * > &ref_edge_list, RefEdge *&new_ref_edge_ptr) |
Create a curve that is a combination of the specified curves. | |
CubitStatus | create_curve_helix (CubitVector &location, CubitVector &direction, CubitVector &start_point, double &thread_distance, double &angle, bool right_handed, RefEdge *&new_ref_edge_ptr) |
CubitBoolean | same_modify_engine (DLIList< TopologyEntity * > &topo_list) const |
Check to determine if all entities are of the same geometry engine. | |
CubitBoolean | same_modify_engine (DLIList< RefEntity * > &ref_entity_list, CubitBoolean check_children=CUBIT_FALSE) const |
Check to determine if all entities are of the same geometry engine as active geometry engine. | |
GeometryModifyEngine * | common_modify_engine (DLIList< RefFace * > &faces, DLIList< RefEdge * > &edges, DLIList< Surface * > &surfaces, DLIList< Curve * > &curves, CubitBoolean allow_composites=CUBIT_FALSE) const |
Determines if specified RefFaces and RefEdges are of the same geometry engine. Returns common engine, if any, and underlying surfaces and curves. | |
CubitStatus | unmerge_and_return_merge_partners (RefVertex *input_vertex, DLIList< DLIList< RefVertex * > * > &vert_merge_lists, DLIList< DLIList< RefEdge * > * > &curve_merge_lists, DLIList< DLIList< RefFace * > * > &surf_merge_lists) |
void | add_gme (GeometryModifyEngine *gme_ptr) |
Add a geometry modify engine to the list. | |
CubitStatus | remove_gme (GeometryModifyEngine *gme_ptr) |
< remove a geometry modify engine from the list; returns CUBIT_FAILURE if it wasn't in the list. | |
void | get_gme_list (DLIList< GeometryModifyEngine * > &gme_list) |
Returns a list of GeometryModifyEngines. | |
GeometryModifyEngine * | get_gme () const |
Gets the current active GeometryModifyEngine. | |
GeometryModifyEngine * | get_engine (TopologyBridge *tb_ptr) const |
Gets the GeometryModifyEngine of this entity. | |
GeometryModifyEngine * | get_engine (TopologyEntity *te_ptr, TopologyBridge **bridge=0) const |
Gets the GeometryModifyEngine of this entity. | |
CubitStatus | get_offset_intersections (RefEdge *ref_edge1, RefEdge *ref_edge2, DLIList< CubitVector > &intersection_list, double offset, CubitBoolean ext_first=CUBIT_TRUE) |
Finds the intersections of a certain distance (offset) between two curves. | |
CubitStatus | get_offset_intersections (RefEdge *ref_edge_ptr, RefFace *ref_face_ptr, DLIList< CubitVector > &intersection_list, double offset=0.0, CubitBoolean ext_surf=CUBIT_TRUE) |
Finds intersections (points) of the curve and surface. | |
CubitStatus | get_mid_plane (RefFace *ref_face_1, RefFace *ref_face_2, Body *body_to_trim_to, DLIList< RefFace * > &mid_plane_surfs) const |
From two surface, create a midplane, then trim it with a body. | |
CubitStatus | get_mid_surface (RefFace *ref_face_1, RefFace *ref_face_2, Body *body_to_trim_to, DLIList< RefFace * > &mid_plane_surfs) const |
Given 2 surfaces, this returns trimmed surfaces of the midsurface (this is an ALPHA feature). | |
CubitStatus | set_default_gme (GeometryModifyEngine *GMEPtr) |
Sets the active geometry engine. | |
GeometryModifyEngine * | group_bodies_by_engine (DLIList< Body * > &remaining_bodies, DLIList< Body * > &engine_bodies, DLIList< BodySM * > &engine_body_sms) const |
Groups Bodies with the same underlying geometry engine into a list. | |
bool | contains_composites (DLIList< TopologyBridge * > &bridge_list) const |
bool | contains_partitions (DLIList< TopologyBridge * > &bridge_list) const |
bool | contains_partitions (DLIList< Body * > &list) const |
bool | contains_composites (DLIList< Body * > &list) const |
CubitStatus | finish_sm_op (DLIList< Body * > &input_bodies, DLIList< BodySM * > &new_bodies, DLIList< Body * > &result_bodies, bool print_info=true) const |
Internal use only. | |
Static Public Member Functions | |
static GeometryModifyTool * | instance (GeometryModifyEngine *GMEPtr=NULL) |
static void | delete_instance () |
static void | set_group_imprint (CubitBoolean flag) |
Sets group imprint flag. | |
static CubitBoolean | get_group_imprint () |
Gets group imprint flag. | |
static void | set_all_edges_imprint (CubitBoolean flag) |
Sets all edges imprint flag. | |
static CubitBoolean | get_all_edges_imprint () |
Gets all edges imprint flag. | |
static void | boolean_regularize (CubitBoolean flag) |
Gets boolean regularize flag. | |
static CubitBoolean | boolean_regularize () |
Sets boolean regularize flag. | |
static CubitBoolean | unite_mixed_models () |
Gets unite mixed models flag. | |
static void | unite_mixed_models (CubitBoolean flag) |
Sets unite mixed models flag. | |
static CubitBoolean | get_new_ids () |
Gets new ids flag. | |
static void | set_new_ids (CubitBoolean flag) |
Sets new ids flag. | |
static CubitBoolean | get_old_names () |
Gets old names flag. | |
static void | set_old_names (CubitBoolean flag) |
Sets old names flag. | |
static void | initialize_settings () |
Initializes all the settings in GeometryModifyTool to defaults. | |
static RefEntity * | get_copy_entity () |
Gets the entity being copied, if any. | |
static void | set_copy_entity (RefEntity *ent) |
Sets the entity being copied. | |
static void | set_sep_after_webcut_setting (CubitBoolean val) |
Sets sepAfterWebcut variable. | |
static CubitBoolean | get_sep_after_webcut_setting () |
Gets sepAfterWebcut variable. | |
static CubitStatus | prepare_for_copy (RefEntity *ref_ents, TopologyBridge *&top_bridge) |
static CubitStatus | finish_copy (TopologyBridge *&new_bridge, TopologyBridge *old_bridge) |
static CubitStatus | clean_up_from_copy_failure (TopologyBridge *old_bridge) |
Protected Member Functions | |
GeometryModifyTool (GeometryModifyEngine *GMEPtr) | |
GeometryModifyEngine * | make_RefEdge_common (RefVertex *start_vertex, RefVertex *end_vertex, TBPoint *&start_point, TBPoint *&end_point, RefFace *ref_face=0, Surface **surface=0) const |
CubitStatus | okay_to_modify (DLIList< Body * > &bodies, const char *op) const |
GeometryModifyEngine * | common_modify_engine (DLIList< Body * > &bodies, DLIList< BodySM * > &bodysms) const |
GeometryModifyEngine * | common_modify_engine (DLIList< RefFace * > &faces, DLIList< Surface * > &surfaces, CubitBoolean allow_composites=CUBIT_FALSE) const |
GeometryModifyEngine * | common_modify_engine (DLIList< RefEdge * > &edges, DLIList< Curve * > &curves, CubitBoolean allow_composites=CUBIT_FALSE) const |
GeometryModifyEngine * | common_modify_engine (DLIList< RefVertex * > &vertices, DLIList< TBPoint * > &points, CubitBoolean allow_composites=CUBIT_FALSE) const |
GeometryModifyEngine * | common_modify_engine (DLIList< TopologyEntity * > &topology_list, DLIList< TopologyBridge * > &engine_bridges, CubitBoolean allow_composites=CUBIT_FALSE) const |
GeometryModifyEngine * | tweak_setup (DLIList< RefFace * > &input_faces, const char *tweak_function_name, DLIList< Body * > &old_bodies_out, DLIList< Surface * > &surfaces_out, CubitBoolean allow_composites=CUBIT_FALSE) |
GeometryModifyEngine * | tweak_setup (DLIList< RefEdge * > &input_edges, const char *tweak_function_name, DLIList< Body * > &old_bodies_out, DLIList< Curve * > &curves_out, CubitBoolean allow_composites=CUBIT_FALSE) |
GeometryModifyEngine * | tweak_setup (DLIList< RefVertex * > &input_vertices, const char *name, DLIList< Body * > &output_bodies, DLIList< TBPoint * > &output_points, CubitBoolean allow_composites=CUBIT_FALSE) |
CubitStatus | sweep_setup (const char *sweep_function_name, DLIList< RefEntity * > &entity_list, DLIList< Body * > &body_list, GeometryModifyEngine *&engine, CubitBoolean &changed_new_ids, DLIList< GeometryEntity * > &geom_list, bool keep_old, DLIList< RefEdge * > *edge_list=0, DLIList< Curve * > *curve_list=0) |
CubitStatus | imprint_singly (DLIList< Body * > &body_list, DLIList< Body * > &new_bodies, CubitBoolean keep_old) |
void | remove_dead_entity_names (RefEntity *entity) const |
Body * | update_body (Body *body) const |
Private Member Functions | |
void | get_merged_curve_and_surface_ids (DLIList< Body * > &bodies, DLIList< int > &merged_surface_ids, DLIList< int > &merged_curve_ids) const |
CubitStatus | match_v1_to_c1 (RefVertex *&v1, RefVertex *&v2, RefVertex *c1_v1, RefVertex *c1_v2, RefVertex *c2_v1, RefVertex *c2_v2) |
CubitStatus | find_best_curves_to_merge (DLIList< RefEdge * > *&curves_from_curve1, DLIList< RefEdge * > *&curves_from_curve2, RefEdge *&curve1, RefEdge *&curve2) |
CubitStatus | unmerge_and_return_merge_partners (RefEdge *input_curve, DLIList< DLIList< RefEdge * > * > &curve_merge_lists, DLIList< DLIList< RefFace * > * > &surf_merge_lists) |
CubitStatus | unmerge_input (RefEdge *curve1, RefEdge *curve2, DLIList< DLIList< RefEdge * > * > &curve_merge_lists, DLIList< DLIList< RefFace * > * > &surf_merge_lists) |
CubitStatus | calculate_split_points_for_merge (RefEdge *c1, RefEdge *c2, DLIList< RefVertex * > &verts_to_merge, double *merge_tolerance, DLIList< CubitVector > &merge_end_points_on_curve1, DLIList< CubitVector > &merge_end_points_on_curve2, DLIList< CubitBoolean > &split_flags_for_curve1, DLIList< CubitBoolean > &split_flags_for_curve2, double divergence_angle) |
CubitStatus | find_overlap_region (RefEdge *c1, RefEdge *c2, RefVertex *v1, RefVertex *v2, bool forward_c1, bool forward_c2, bool &full_c1, bool &full_c2, double &c1_stop_param, double &c2_stop_param, double divergence_angle) |
CubitStatus | separate_body_after_webcut (DLIList< Body * > &input_list, DLIList< Body * > &output_list) const |
void | fixup_merged_entities (DLIList< int > &merged_surface_ids, DLIList< int > &merged_curve_ids) const |
bool | contains_intermediate_geom (DLIList< Body * > &list) const |
bool | contains_intermediate_geom (DLIList< TopologyBridge * > &list) const |
void | do_attribute_setup (void) |
void | do_attribute_cleanup (void) |
void | push_attributes_before_modify (DLIList< BodySM * > &old_sms) |
CubitStatus | restore_vg_after_modify (DLIList< BodySM * > &new_sms, DLIList< Body * > &old_bodies, GeometryModifyEngine *gme) |
void | remove_pushed_attributes (DLIList< BodySM * > &new_sms, DLIList< Body * > &old_bodies) |
void | push_imprint_attributes_before_modify (DLIList< BodySM * > &old_sms) |
void | push_named_attributes_to_curves_and_points (DLIList< TopologyBridge * > &tb_list, const char *name_in) |
void | remove_imprint_attributes_after_modify (DLIList< BodySM * > &body_sms, DLIList< BodySM * > &new_sms) |
void | propagate_from_small_edge (RefEdge *edge, DLIList< RefEdge * > &small_edges, DLIList< RefFace * > &narrow_faces, DLIList< RefFace * > &processed_faces, double small_edge_length) |
void | propagate_over_narrow_face (RefFace *narrow_face, RefEdge *edge, DLIList< RefFace * > &processed_faces, DLIList< RefEdge * > &small_edges, DLIList< RefFace * > &narrow_faces, double small_edge_length) |
void | propagate_merge_tolerance (DLIList< Body * > &body_list) |
void | push_tolerance_attribute (DLIList< Body * > &body_list) |
CubitStatus | prepare_bc_for_webcut () |
CubitStatus | finish_bc_webcut () |
CubitStatus | sweep_finish (const char *const sweep_function_name, DLIList< Body * > &input_body_list, DLIList< BodySM * > &new_body_list, DLIList< Body * > &output_body_list, CubitBoolean restore_newids) |
CubitStatus | finish_webcut (DLIList< Body * > &input_bodies, DLIList< BodySM * > &webcut_results, CubitBoolean merge, CubitStatus webcut_status, DLIList< Body * > &new_bodies, DLIList< int > *merged_surface_ids=NULL, DLIList< int > *merged_curve_ids=NULL, CubitBoolean print_info=CUBIT_TRUE) const |
CubitStatus | tweak_remove (DLIList< RefFace * > &ref_face_list, DLIList< Body * > &new_body_list, CubitBoolean extend_adjoining=CUBIT_TRUE, CubitBoolean keep_surface=CUBIT_FALSE, CubitBoolean keep_old_body=CUBIT_FALSE, CubitBoolean preview=CUBIT_FALSE) |
void | get_neighboring_bodies (DLIList< Body * > &input_bodies, DLIList< Body * > &neighboring_bodies) |
CubitStatus | unite_separately (GeometryModifyEngine *gme_ptr, DLIList< Body * > &body_list, DLIList< Body * > &new_body_list, bool keep_old) |
CubitStatus | unite_all (GeometryModifyEngine *gme_ptr, DLIList< Body * > &body_list, DLIList< Body * > &new_body_list, bool keep_old) |
CubitStatus | unite_private (GeometryModifyEngine *gme_ptr, DLIList< Body * > &body_list, DLIList< Body * > &new_body_list, bool keep_old) |
GeometryModifyEngine * | pull_common_surfs (DLIList< RefFace * > &ref_face_list, DLIList< RefFace * > &common_face_list, DLIList< Surface * > &common_surf_list) |
void | remove_bodies_outside_bounding_box (DLIList< Body * > &body_list, CubitVector v1, CubitVector v2, CubitVector v3) |
void | remove_bodies_outside_bounding_box (DLIList< Body * > &body_list, CubitBox &tool_bounding_box) |
CubitVector | FindExtendedEndPt (double outer_rad, double inner_rad, CubitVector inner_AxisPt, CubitVector Axis, double Height) |
CubitVector | FindExtendedStartPt (CubitBox box, double outer_rad, double inner_rad, CubitVector inner_AxisPt, CubitVector Axis, double &Height, double dTanAngle, double &dExtendedadius) |
void | FindExtendedPoints (CubitVector AxisPt1, CubitVector AxisPt2, double outer_radius, double inner_radius, CubitVector axis, double Height, CubitBox bounding_box, double dTanAngle, CubitVector &start, CubitVector &end, double &dExtended_OuterRadius, double &dExtended_InnerRadius) |
void | preview_align (CubitVector translation_to_origin, CubitVector origin_to_target, double angle_of_rotation, CubitVector axis_of_rotation, DLIList< RefEntity * > &entities) |
Static Private Member Functions | |
static void | plane_preview (DLIList< Body * > &body_list, const CubitVector &pt1, const CubitVector &pt2, const CubitVector &pt3) |
draw a preview of a plane for webcut previews | |
static CubitStatus | create_old_to_new_ref_ent_map (TopologyBridge *old_top_level_bridge, TopologyBridge *new_top_level_bridge, std::map< RefEntity *, RefEntity * > &old_to_new_map, std::map< TopologyBridge *, TopologyBridge * > &old_tb_to_new_tb) |
Private Attributes | |
DLIList< GeometryModifyEngine * > | gmeList |
The list of geometry modify engines. | |
Static Private Attributes | |
static GeometryModifyTool * | instance_ = 0 |
Static pointer to the unique instance of this class. | |
static CubitBoolean | groupImprint = CUBIT_TRUE |
Use group imprinting, which is much faster. Default: true. | |
static CubitBoolean | meshAutodelete = CUBIT_TRUE |
An object will be unmeshed if modified or deleted. Default: true. | |
static CubitBoolean | meshAutodeleteRemesh = CUBIT_FALSE |
An object will be cached if the mesh is autodeleted and can be remeshed later. Default: false. | |
static CubitBoolean | newIds = CUBIT_FALSE |
Causes code to reuse old ids, which are more persistent. Default: false. | |
static CubitBoolean | oldNames = CUBIT_FALSE |
Attempt entity naming backwards compatible with v8/pre-bool-on-merged. Default: false. | |
static CubitBoolean | sepAfterWebcut = CUBIT_TRUE |
Separate the result bodies of webcutting into single-body volumes. Default: true. | |
static CubitBoolean | allEdgesImprint = CUBIT_TRUE |
static CubitBoolean | booleanRegularize = CUBIT_TRUE |
Regularized booleans are performed. Default: true. | |
static CubitBoolean | uniteMixedModels = CUBIT_TRUE |
Unite operations can mix sheet bodies with solid bodies. Default: true. | |
static RefEntity * | copyingEntity = NULL |
This pointer points to the entity that is being copied. | |
Friends | |
class | MergeTool |
Interface class for modifying geometry.
Definition at line 66 of file GeometryModifyTool.hpp.
Destructor.
Definition at line 190 of file GeometryModifyTool.cpp.
GeometryModifyTool::GeometryModifyTool | ( | GeometryModifyEngine * | GMEPtr | ) | [protected] |
Constructor for the (singleton) GeometryModifyTool object
Definition at line 5777 of file GeometryModifyTool.cpp.
void GeometryModifyTool::add_gme | ( | GeometryModifyEngine * | gme_ptr | ) | [inline] |
Add a geometry modify engine to the list.
add a geometry query engine to the list
Definition at line 2500 of file GeometryModifyTool.hpp.
CubitStatus GeometryModifyTool::align_entities | ( | RefFace * | my_face, |
RefFace * | target_face, | ||
DLIList< RefEntity * > & | entities_to_move, | ||
bool | reverse, | ||
CubitVector & | my_center, | ||
CubitVector & | axis_of_rot, | ||
CubitVector & | target_center, | ||
double & | angle, | ||
bool | preview | ||
) |
Compute the transformation required to align my_face with target_face with respect to reference_body_ptr. Then perform the transformation on all entities in entities_to_move.
Aligns the body that contains my_face to match my_face with the target face..
Definition at line 3973 of file GeometryModifyTool.cpp.
{ // Initialize angle to zero, so we are passing back a valid // value if we never need to rotate the body angle = 0.0; //Align the body, which contains my_face, with the target_face. //Essentially we want to align the body at my_face with the target_face. my_center = source_face->center_point(); target_center = target_face->center_point(); CubitVector my_vector = source_face->normal_at( my_center ); CubitVector target_vector = target_face->normal_at( target_center ); if( CubitUndo::get_undo_enabled() && !preview ) { DLIList<RefEntity*> free_ents_to_save; DLIList<Body*> align_list(entities_to_move.size()); for ( int k=0; k<entities_to_move.size(); k++ ) { RefEntity *ref_ent = entities_to_move[k]; Body *tmp_body = dynamic_cast<Body*>(ref_ent); if( tmp_body ) align_list.append( tmp_body ); else free_ents_to_save.append( ref_ent ); } CubitUndo::save_state_with_cubit_file( align_list, &free_ents_to_save ); } axis_of_rot = my_vector * target_vector; if( axis_of_rot.length() < CUBIT_RESABS ) { CubitVector v1,v2; my_vector.orthogonal_vectors(v1, v2 ); axis_of_rot = v1; } if( axis_of_rot.length() > CUBIT_RESABS ) { angle = axis_of_rot.vector_angle( my_vector, target_vector ); //Now we have the angle and the axis to rotate about... angle = 180.0*angle/CUBIT_PI; if( angle > 90 ) angle = angle - 180; if( reverse ) angle += 180; } CubitVector origin(0.,0.,0.); if (preview) { preview_align( -my_center, target_center, angle, axis_of_rot, entities_to_move ); } else { //Move the body so that the center of my_face //is at the origin. DLIList<RefEntity*> entities_transformed; GeometryQueryTool::instance()->translate( entities_to_move, -my_center.x(), -my_center.y(), -my_center.z(), false, entities_transformed); //If the axis length is zero we dont want to do a rotation, //they are already parallel.. if (axis_of_rot.length() > CUBIT_RESABS ) { //Now rotate the body about the axis. GeometryQueryTool::instance()->rotate(entities_to_move, origin, axis_of_rot, angle, false, entities_transformed, false); } //Now move the body to the location of the target_center. GeometryQueryTool::instance()->translate( entities_to_move, target_center.x(), target_center.y(), target_center.z(), false, entities_transformed, preview); } //That should do it. return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::align_entities | ( | DLIList< RefEntity * > & | entities_to_move, |
CubitVector & | position_to_align, | ||
CubitVector & | position_to_align_to, | ||
CubitVector & | axis_origin, | ||
CubitVector & | axis_of_rot, | ||
double & | angle_of_rotation, | ||
bool | preview | ||
) |
Aligns entities by rotating about them about axis from one point to another.
Definition at line 4075 of file GeometryModifyTool.cpp.
{ //project pos_to_align to axis axis_of_rot.normalize(); CubitVector tmp_vec = pos_to_align - axis_origin; double dot_prod = tmp_vec%axis_of_rot; CubitVector int_pt1 = axis_origin + (dot_prod*axis_of_rot); //project pos_to_align_to to axis tmp_vec = pos_to_align_to - axis_origin; dot_prod = tmp_vec%axis_of_rot; CubitVector int_pt2 = axis_origin + (dot_prod*axis_of_rot); //determine angle of rotation tmp_vec = pos_to_align - int_pt1; CubitVector tmp_vec2 = pos_to_align_to - int_pt2; angle_of_rotation = axis_of_rot.vector_angle( tmp_vec, tmp_vec2 ); angle_of_rotation *= 180.0/CUBIT_PI; if( angle_of_rotation < CUBIT_RESABS ) { PRINT_WARNING("Points already aligned.\n"); return CUBIT_SUCCESS; } if( CubitUndo::get_undo_enabled() && !preview ) { DLIList<RefEntity*> free_ents_to_save; DLIList<Body*> align_list(entities_to_align.size()); for ( int k=0; k<entities_to_align.size(); k++ ) { RefEntity *ref_ent = entities_to_align[k]; Body *tmp_body = dynamic_cast<Body*>(ref_ent); if( tmp_body ) align_list.append( tmp_body ); else free_ents_to_save.append( ref_ent ); } CubitUndo::save_state_with_cubit_file( align_list, &free_ents_to_save ); } CubitVector translation_vector( int_pt1 ); if( preview ) { preview_align( -translation_vector, translation_vector, angle_of_rotation, axis_of_rot, entities_to_align ); } else { //translate to origin DLIList<RefEntity*> entities_transformed; GeometryQueryTool::instance()->translate( entities_to_align, -translation_vector.x(), -translation_vector.y(), -translation_vector.z(), false, entities_transformed); //rotate to align CubitVector origin(0,0,0); GeometryQueryTool::instance()->rotate( entities_to_align, origin, axis_of_rot, angle_of_rotation, false, entities_transformed, false ); //translate back GeometryQueryTool::instance()->translate( entities_to_align, translation_vector.x(), translation_vector.y(), translation_vector.z(), false, entities_transformed); } //That should do it. return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::align_entities | ( | DLIList< RefEntity * > & | reference_entities, |
DLIList< RefEntity * > & | entities_to_move, | ||
CubitVector | align_to_vec, | ||
CubitVector & | my_center, | ||
CubitVector & | axis_of_rot, | ||
double & | angle, | ||
bool | preview | ||
) |
Aligns a the normal of a surface or a line to a plane.
Definition at line 4158 of file GeometryModifyTool.cpp.
{ DLIList<RefFace*> ref_face_list; DLIList<RefVertex*> ref_vertex_list; CAST_LIST(reference_entities, ref_face_list, RefFace); CAST_LIST(reference_entities, ref_vertex_list, RefVertex); angle = 0.0; CubitVector translation_vector; CubitVector axis_of_rotation; CubitVector vector_to_rotate; if( ref_face_list.size() == 1 && ref_vertex_list.size() == 0 ) { //now form the axis of rotation RefFace *my_face = ref_face_list.get_and_step(); translation_vector = my_face->center_point(); my_center = translation_vector; vector_to_rotate = my_face->normal_at( translation_vector ); axis_of_rot = align_to_vec * vector_to_rotate; } else if( ref_face_list.size() == 0 && ref_vertex_list.size() == 2 ) { RefVertex *vertex_1 = ref_vertex_list.get_and_step(); RefVertex *vertex_2 = ref_vertex_list.get_and_step(); //now form the axis of rotation translation_vector = vertex_1->coordinates(); my_center = vertex_1->coordinates(); vector_to_rotate = vertex_2->coordinates() - vertex_1->coordinates(); axis_of_rot = align_to_vec * vector_to_rotate; } if( axis_of_rot.length() < CUBIT_RESABS ) { double dot_prod = align_to_vec%vector_to_rotate; //normals could be 180 degrees from one another if( dot_prod < 0 ) { CubitVector v1,v2; align_to_vec.orthogonal_vectors(v1, v2 ); axis_of_rot = v1; } } if( CubitUndo::get_undo_enabled() && !preview ) { DLIList<RefEntity*> free_ents_to_save; DLIList<Body*> align_list(entities_to_move.size()); for ( int k=0; k<entities_to_move.size(); k++ ) { RefEntity *ref_ent = entities_to_move[k]; Body *tmp_body = dynamic_cast<Body*>(ref_ent); if( tmp_body ) align_list.append( tmp_body ); else free_ents_to_save.append( ref_ent ); } CubitUndo::save_state_with_cubit_file( align_list, &free_ents_to_save ); } //determine the angle of rotation angle = axis_of_rot.vector_angle( vector_to_rotate, align_to_vec ); angle = 180.0*angle/CUBIT_PI; if( preview ) { preview_align( -translation_vector, translation_vector, angle, axis_of_rot, entities_to_move ); } else { //translate to origin DLIList<RefEntity*> entities_transformed; GeometryQueryTool::instance()->translate( entities_to_move, -translation_vector.x(), -translation_vector.y(), -translation_vector.z(), false, entities_transformed); //rotate to align CubitVector origin(0,0,0); GeometryQueryTool::instance()->rotate( entities_to_move, origin, axis_of_rot, angle, false, entities_transformed, false ); //translate back GeometryQueryTool::instance()->translate( entities_to_move, translation_vector.x(), translation_vector.y(), translation_vector.z(), false, entities_transformed); } //That should do it. return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::auto_mid_surface | ( | DLIList< Body * > & | body_list_in, |
DLIList< Body * > & | body_list_out, | ||
DLIList< Body * > & | old_bodies_midsurfaced, | ||
DLIList< double > & | thickness_list, | ||
double | lower_tol, | ||
double | upper_tol, | ||
CubitBoolean | delete_midsurfaced, | ||
CubitBoolean | preview | ||
) |
Create a midsurface from a volume.
Automatically create a midsurface from a volume. {body_list_in} - list of bodies to midsurface {body_list_out} - resulting midsurfaces {lower_tol} - lower tolerance for finding surface pairs {upper_tol} - upper tolerance for finding surface pairs {preview} - preview midsurfaces
Definition at line 10478 of file GeometryModifyTool.cpp.
{ // Check for virtual geometry DLIList<RefEntity*> ref_ent_list; CAST_LIST_TO_PARENT(body_list_in, ref_ent_list); if ( GeometryQueryTool::instance()->contains_intermediate_geometry(ref_ent_list) ) { PRINT_ERROR("Midsurfacing volumes containing virtual geometry is not\n" " allowed. Delete virtual geometry on these surfaces\n" " before operation.\n" ); return CUBIT_FAILURE; } // Make sure all surfaces are from same geometry engine if ( !same_modify_engine(ref_ent_list, CUBIT_TRUE) ) { PRINT_ERROR("Performing Midsurface with geometry from\n" "different modeling engines is not allowed.\n"); return CUBIT_FAILURE; } AutoMidsurfaceTool mid_tool; DLIList<BodySM*> bodysm_list_out; if (CubitUndo::get_undo_enabled() && delete_midsurfaced && !preview) CubitUndo::save_state_with_cubit_file(body_list_in); CubitStatus result = mid_tool.midsurface( body_list_in, bodysm_list_out, old_bodies_midsurfaced, thickness_list, lower_tol, upper_tol, delete_midsurfaced, preview); if (result == CUBIT_SUCCESS && bodysm_list_out.size() > 0 && !preview) { if(CubitUndo::get_undo_enabled()) CubitUndo::save_state(); for( int i=0; i<bodysm_list_out.size(); i++ ) { body_list_out.append(GeometryQueryTool::instance()->make_Body(bodysm_list_out[i])); } if( CubitUndo::get_undo_enabled() ) { if( body_list_out.size() ) CubitUndo::note_result_bodies( body_list_out ); else CubitUndo::remove_last_undo(); } } return result; }
void GeometryModifyTool::boolean_regularize | ( | CubitBoolean | flag | ) | [inline, static] |
Gets boolean regularize flag.
Definition at line 2492 of file GeometryModifyTool.hpp.
{booleanRegularize = flag;}
CubitBoolean GeometryModifyTool::boolean_regularize | ( | ) | [inline, static] |
Sets boolean regularize flag.
Definition at line 2490 of file GeometryModifyTool.hpp.
{return booleanRegularize;}
Body * GeometryModifyTool::brick | ( | double | wid, |
double | dep, | ||
double | hi | ||
) |
Creates a brick (cube).
Creates an cuboid and assigns it to a Body $ {wid, dep, hi} input width, depth, height Returns the new Body or NULL
Definition at line 355 of file GeometryModifyTool.cpp.
{ if (0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } // First make sure that none of the input values are zero or less if ( width <= GEOMETRY_RESABS || depth <= GEOMETRY_RESABS || height <= GEOMETRY_RESABS ) { PRINT_ERROR("In GeometryModifyTool::brick\n" " Cannot make a cuboid of size %f x %f x %f\n" " All dimensions must be > 0.0\n", width, depth, height); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); Body *new_body = NULL; BodySM* bodyPtr = gmeList.get()->brick(width, depth, height); if (bodyPtr == NULL) { PRINT_ERROR("In GeometryModifyTool::brick\n" " Problem creating a brick.\n") ; } else new_body = GeometryQueryTool::instance()->make_Body(bodyPtr); if( CubitUndo::get_undo_enabled() ) { if( new_body ) CubitUndo::note_result_body( new_body ); else CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::brick | ( | const CubitVector & | center, |
const CubitVector | axes[3], | ||
const CubitVector & | extension | ||
) |
Creates a brick (cube).
Creates an cuboid and assigns it to a Body $ {center, axes, extension} input center, xyz axes, extension (extension vector is 1/2 width, height, depth) If one of dimensions is zero a planar sheet should be created. Returns the new Body or NULL
Definition at line 434 of file GeometryModifyTool.cpp.
{ if (0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } double width = 2.0*extension.x(); double height = 2.0*extension.y(); double depth = 2.0*extension.z(); // First make sure that entity creation is possible. Allow at most // only one of the dimensions to be zero - in which case a planar // sheet is created. if ( width < 0.0 || height < 0.0 || depth < 0.0 ) { PRINT_ERROR( "Cannot make a brick of size %f x %f x %f\n" " Negative dimensions are not allowed.\n", width, height, depth ); return NULL ; } int wz = width < GEOMETRY_RESABS; int hz = height < GEOMETRY_RESABS; int dz = depth < GEOMETRY_RESABS; if( wz || hz || dz ) { if( (wz + hz + dz) > 1 ) { PRINT_ERROR( "Cannot make a sheet of size %f x %f x %f\n" " At least two dimensions must be nonzero.\n", width, height, depth ); return NULL ; } // Make a sheet body instead of a cuboid CubitVector sheet_axes[2]; if( wz ) { sheet_axes[0] = axes[1]; sheet_axes[1] = axes[2]; return planar_sheet( center, sheet_axes, height, depth ); } else if( hz ) { sheet_axes[0] = axes[2]; sheet_axes[1] = axes[0]; return planar_sheet( center, sheet_axes, depth, width ); } else { sheet_axes[0] = axes[0]; sheet_axes[1] = axes[1]; return planar_sheet( center, sheet_axes, width, height ); } } else { if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); BodySM* bodyPtr = gmeList.get()->brick(center, axes, extension) ; Body *new_body = NULL; if (bodyPtr == NULL) { PRINT_ERROR("In GeometryTool::brick\n" " Problem creating a brick.\n") ; } else new_body = GeometryQueryTool::instance()->make_Body(bodyPtr); if( CubitUndo::get_undo_enabled() ) { if( new_body ) CubitUndo::note_result_body( new_body ); else CubitUndo::remove_last_undo(); } return new_body; } }
CubitStatus GeometryModifyTool::calculate_split_points_for_merge | ( | RefEdge * | c1, |
RefEdge * | c2, | ||
DLIList< RefVertex * > & | verts_to_merge, | ||
double * | merge_tolerance, | ||
DLIList< CubitVector > & | merge_end_points_on_curve1, | ||
DLIList< CubitVector > & | merge_end_points_on_curve2, | ||
DLIList< CubitBoolean > & | split_flags_for_curve1, | ||
DLIList< CubitBoolean > & | split_flags_for_curve2, | ||
double | divergence_angle | ||
) | [private] |
Definition at line 19547 of file GeometryModifyTool.cpp.
{ CubitStatus status = CUBIT_SUCCESS; bool all_done = false; // Get the vertices of the two curves. RefVertex *c1_v1 = c1->start_vertex(); RefVertex *c1_v2 = c1->end_vertex(); RefVertex *c2_v1 = c2->start_vertex(); RefVertex *c2_v2 = c2->end_vertex(); // Check for closed curves. bool c1_closed = false; if(c1_v1 == c1_v2) c1_closed = true; bool merge_verts_at_both_ends = false; // If we are told that certain vertices need to merge // we will know that we do not need to split the curves there. bool full_c1=false, full_c2=false; int verts_to_merge_size = verts_to_merge.size(); RefVertex *v1, *v2; if(verts_to_merge_size > 0) { // Verts to merge should always come in pairs. if(verts_to_merge_size % 2 != 0) { status = CUBIT_FAILURE; } else { if(verts_to_merge_size > 2 || c1_closed) merge_verts_at_both_ends = true; verts_to_merge.reset(); // Process the first set of verts to merge. v1 = verts_to_merge.get_and_step(); v2 = verts_to_merge.get_and_step(); // Make sure v1 corresponds to c1 and v2 to c2. status = match_v1_to_c1(v1, v2, c1_v1, c1_v2, c2_v1, c2_v2); } if(status == CUBIT_SUCCESS) { // Determine whether the verts are at the // beginning or end of curves. bool forward_c1, forward_c2; if(v1 == c1_v1) forward_c1 = true; else forward_c1 = false; if(v2 == c2_v1) forward_c2 = true; else forward_c2 = false; double c1_stop_param, c2_stop_param; status = find_overlap_region(c1, c2, v1, v2, forward_c1, forward_c2, full_c1, full_c2, c1_stop_param, c2_stop_param, divergence_angle); if(status == CUBIT_SUCCESS) { merge_end_points_on_curve1.append(v1->coordinates()); merge_end_points_on_curve2.append(v2->coordinates()); split_flags_for_curve1.append(CUBIT_FALSE); split_flags_for_curve2.append(CUBIT_FALSE); // If we traversed the whole length of either curve and // we are told to merge the verts at both ends then // just add the verts at the other end and be done. if((full_c1 || full_c2) && merge_verts_at_both_ends) { split_flags_for_curve1.append(CUBIT_FALSE); split_flags_for_curve2.append(CUBIT_FALSE); if(c1_v1 == v1) merge_end_points_on_curve1.append(c1_v2->coordinates()); else merge_end_points_on_curve1.append(c1_v1->coordinates()); if(c2_v1 == v2) merge_end_points_on_curve2.append(c2_v2->coordinates()); else merge_end_points_on_curve2.append(c2_v1->coordinates()); all_done = true; } else { if(full_c2) { RefVertex *tmp_vert; if(c2_v1 == v2) tmp_vert = c2_v2; else tmp_vert = c2_v1; merge_end_points_on_curve2.append(tmp_vert->coordinates()); split_flags_for_curve2.append(CUBIT_FALSE); if(!full_c1) { CubitVector pos1; c1->closest_point_trimmed(tmp_vert->coordinates(), pos1); merge_end_points_on_curve1.append(pos1); split_flags_for_curve1.append(CUBIT_TRUE); } else { if(c1_v1 == v1) merge_end_points_on_curve1.append(c1_v2->coordinates()); else merge_end_points_on_curve1.append(c1_v1->coordinates()); split_flags_for_curve1.append(CUBIT_FALSE); } } else { split_flags_for_curve2.append(CUBIT_TRUE); if(full_c1) { split_flags_for_curve1.append(CUBIT_FALSE); if(c1_v1 == v1) { merge_end_points_on_curve1.append(c1_v2->coordinates()); // we need to imprint the end of c1 onto c2. CubitVector pos2; c2->closest_point_trimmed(c1_v2->coordinates(), pos2); merge_end_points_on_curve2.append(pos2); } else { merge_end_points_on_curve1.append(c1_v1->coordinates()); // we need to imprint the end of c1 onto c2. CubitVector pos2; c2->closest_point_trimmed(c1_v1->coordinates(), pos2); merge_end_points_on_curve2.append(pos2); } } else { split_flags_for_curve1.append(CUBIT_TRUE); // we need to imprint the end of c2 onto c1. CubitVector pos1; c1->position_from_u(c1_stop_param, pos1); merge_end_points_on_curve1.append(pos1); // we need to imprint the end of c1 onto c2. CubitVector pos2; c2->closest_point_trimmed(pos1, pos2); merge_end_points_on_curve2.append(pos2); } } } } } if(status == CUBIT_SUCCESS && !all_done) { if(merge_verts_at_both_ends) { // Process the next set of verts to merge. v1 = verts_to_merge.get_and_step(); v2 = verts_to_merge.get_and_step(); // Make sure v1 corresponds to c1 and v2 to c2. status = match_v1_to_c1(v1, v2, c1_v1, c1_v2, c2_v1, c2_v2); if(status == CUBIT_SUCCESS) { // Determine whether the verts are at the // beginning or end of curves. bool forward_c1, forward_c2; if(v1 == c1_v1) forward_c1 = true; else forward_c1 = false; if(v2 == c2_v1) forward_c2 = true; else forward_c2 = false; double c1_stop_param, c2_stop_param; bool full_c1=false, full_c2=false; status = find_overlap_region(c1, c2, v1, v2, forward_c1, forward_c2, full_c1, full_c2, c1_stop_param, c2_stop_param, divergence_angle); if(status == CUBIT_SUCCESS) { merge_end_points_on_curve1.append(v1->coordinates()); merge_end_points_on_curve2.append(v2->coordinates()); split_flags_for_curve1.append(CUBIT_FALSE); split_flags_for_curve2.append(CUBIT_FALSE); split_flags_for_curve1.append(CUBIT_TRUE); split_flags_for_curve2.append(CUBIT_TRUE); // we need to imprint the end of c2 onto c1. CubitVector pos1; c1->position_from_u(c1_stop_param, pos1); merge_end_points_on_curve1.append(pos1); // we need to imprint the end of c1 onto c2. CubitVector pos2; c2->position_from_u(c2_stop_param, pos2); merge_end_points_on_curve2.append(pos2); } } } } } if(status == CUBIT_SUCCESS) { } return status; }
CubitStatus GeometryModifyTool::chop | ( | DLIList< Body * > & | bodies, |
DLIList< Body * > & | intersectBodies, | ||
DLIList< Body * > & | outsideBodies, | ||
Body *& | leftoversBody, | ||
bool | keep_old = false , |
||
bool | nonreg = false |
||
) |
Intersects and subtracts the two bodies in the list.
Definition at line 6685 of file GeometryModifyTool.cpp.
{ leftoversBody = 0; if (bodies.size() <= 1) { PRINT_WARNING("There is only one body in the list. Nothing modified\n"); return CUBIT_FAILURE; } if (!okay_to_modify( bodies, "CHOP" )) return CUBIT_FAILURE; int i; const int count = bodies.size(); DLIList<Body*> original_body_list = bodies; DLIList<TopologyEntity*> entity_list(count); DLIList<TopologyBridge*> bridge_list(count); bodies.reset(); for (i = bodies.size(); i--; ) entity_list.append_unique(bodies.get_and_step()); GeometryModifyEngine* gme = common_modify_engine( entity_list, bridge_list ); if ( !gme ) { PRINT_ERROR("Performing CHOP with volumes containing geometry\n" " from different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } DLIList<BodySM*> body_sm_list; CAST_LIST( bridge_list, body_sm_list, BodySM ); DLIList<BodySM*> intersect_bodies, outside_bodies; BodySM *leftovers_body = 0; if( CubitUndo::get_undo_enabled() ) { if( keep_old ) CubitUndo::save_state(); else { //Get all the bodies associated with the vertex CubitUndo::save_state_with_cubit_file( bodies ); } } DLIList<int> merged_surface_ids; DLIList<int> merged_curve_ids; DLIList<Body*> tmp_bodies(1); tmp_bodies.append( bodies.get() ); if( keep_old == CUBIT_FALSE ) get_merged_curve_and_surface_ids( tmp_bodies, merged_surface_ids, merged_curve_ids ); do_attribute_setup(); // Push attributes down onto the blank body (first one in list). DLIList<BodySM*> tmp_body_sm_list; body_sm_list.reset(); tmp_body_sm_list.append(body_sm_list.get()); push_attributes_before_modify(tmp_body_sm_list); CubitStatus result = gme->chop( body_sm_list, intersect_bodies, outside_bodies, leftovers_body, keep_old, nonreg ); if( result == CUBIT_FAILURE ) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("CHOP failed\n"); remove_pushed_attributes(tmp_body_sm_list, tmp_bodies); do_attribute_cleanup(); return CUBIT_FAILURE; } DLIList<BodySM*> all_sms = intersect_bodies; all_sms += outside_bodies; restore_vg_after_modify(all_sms, tmp_bodies, gme); remove_pushed_attributes(all_sms, tmp_bodies); DLIList<Body*> result_bodies; body_sm_list.clean_out(); body_sm_list += intersect_bodies; CubitStatus stat = finish_sm_op(bodies, body_sm_list, result_bodies); if( CubitUndo::get_undo_enabled() ) { if( stat == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( result_bodies ); else CubitUndo::remove_last_undo(); } if( stat == CUBIT_FAILURE ) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("CHOP failed\n"); do_attribute_cleanup(); return CUBIT_FAILURE; } intersectBodies += result_bodies; bodies.clean_out(); body_sm_list.clean_out(); body_sm_list += outside_bodies; result_bodies.clean_out(); if (!finish_sm_op(bodies, body_sm_list, result_bodies)) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("CHOP failed\n"); do_attribute_cleanup(); return CUBIT_FAILURE; } outsideBodies += result_bodies; if( leftovers_body ) { body_sm_list.clean_out(); body_sm_list.append( leftovers_body ); result_bodies.clean_out(); if (!finish_sm_op(bodies, body_sm_list, result_bodies)) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("CHOP failed\n"); do_attribute_cleanup(); return CUBIT_FAILURE; } leftoversBody = result_bodies.get(); } if( keep_old == CUBIT_FALSE ) fixup_merged_entities( merged_surface_ids, merged_curve_ids); if( CubitUndo::get_undo_enabled() ) { if( leftoversBody ) { DLIList<Body*> tmp_list(1); tmp_list.append( leftoversBody ); CubitUndo::note_result_bodies( tmp_list ); } CubitUndo::note_result_bodies( intersectBodies ); CubitUndo::note_result_bodies( outsideBodies ); } do_attribute_cleanup(); return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::clean_up_from_copy_failure | ( | TopologyBridge * | old_bridge | ) | [static] |
Definition at line 1222 of file GeometryModifyTool.cpp.
{ //Remove attributes on underlying entities of virtual geometry //entities which do not have corresponding RefEntities. DLIList<TopologyBridge*> bridge_list; bridge_list.append( old_bridge ); GeometryQueryTool::instance()->ige_remove_attributes( bridge_list ); //Remove attributes on original entity and children DLIList<RefEntity*> child_list; RefEntity *ref_ent = CAST_TO( old_bridge->topology_entity(), RefEntity ); ref_ent->get_all_child_ref_entities( child_list ); //child_list.append( ref_ent ); CubitAttribUser::clear_all_simple_attrib( child_list ); child_list.clean_out(); child_list.append( ref_ent ); CubitAttribUser::clear_all_simple_attrib( child_list ); CGMApp::instance()->restore_previous_attribute_states(); return CUBIT_SUCCESS; }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< RefFace * > & | faces, |
DLIList< RefEdge * > & | edges, | ||
DLIList< Surface * > & | surfaces, | ||
DLIList< Curve * > & | curves, | ||
CubitBoolean | allow_composites = CUBIT_FALSE |
||
) | const |
Determines if specified RefFaces and RefEdges are of the same geometry engine. Returns common engine, if any, and underlying surfaces and curves.
Definition at line 11717 of file GeometryModifyTool.cpp.
{ int i; const int count = face_list.size() + edge_list.size(); DLIList<TopologyEntity*> entity_list(count); DLIList<TopologyBridge*> bridge_list(count); face_list.reset(); edge_list.reset(); for (i = face_list.size(); i--; ) entity_list.append(face_list.get_and_step()); for (i = edge_list.size(); i--; ) entity_list.append(edge_list.get_and_step()); GeometryModifyEngine* engine = common_modify_engine(entity_list, bridge_list, allow_composites); if (!engine) return 0; entity_list.reset(); CAST_LIST(bridge_list, surf_list, Surface); CAST_LIST(bridge_list, curv_list, Curve ); if(allow_composites) { if(surf_list.size() >= face_list.size() && curv_list.size() >= edge_list.size()) return engine; else return 0; } else { if (surf_list.size() != face_list.size() || curv_list.size() != edge_list.size()) return 0; else return engine; } }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< Body * > & | bodies, |
DLIList< BodySM * > & | bodysms | ||
) | const [protected] |
Definition at line 11676 of file GeometryModifyTool.cpp.
{ input.reset(); Body* body_ptr = input.get(); BodySM* body_sm_ptr = body_ptr->get_body_sm_ptr(); GeometryModifyEngine* engine = get_engine(body_sm_ptr); for (int i = input.size(); i--; ) { body_ptr = input.get_and_step(); body_sm_ptr = body_ptr->get_body_sm_ptr(); output.append(body_sm_ptr); if (!body_sm_ptr) { PRINT_ERROR("Body %d is invalid -- no attached BodySM.\n", body_ptr->id()); output.clean_out(); return 0; } if (get_engine(body_sm_ptr) != engine) { output.clean_out(); return 0; } } return engine; }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< RefFace * > & | faces, |
DLIList< Surface * > & | surfaces, | ||
CubitBoolean | allow_composites = CUBIT_FALSE |
||
) | const [protected] |
Definition at line 11768 of file GeometryModifyTool.cpp.
{ const int size = face_list.size(); DLIList<TopologyEntity*> topo_list(size); DLIList<TopologyBridge*> geom_list(size); GeometryModifyEngine* result; CAST_LIST_TO_PARENT( face_list, topo_list ); result = common_modify_engine( topo_list, geom_list, allow_composites ); CAST_LIST( geom_list, surf_list, Surface ); return result; }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< RefEdge * > & | edges, |
DLIList< Curve * > & | curves, | ||
CubitBoolean | allow_composites = CUBIT_FALSE |
||
) | const [protected] |
Definition at line 11793 of file GeometryModifyTool.cpp.
{ const int size = edge_list.size(); DLIList<TopologyEntity*> topo_list(size); DLIList<TopologyBridge*> geom_list(size); GeometryModifyEngine* result; CAST_LIST_TO_PARENT( edge_list, topo_list ); result = common_modify_engine( topo_list, geom_list, allow_composites ); CAST_LIST( geom_list, curve_list, Curve ); return result; }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< RefVertex * > & | vertices, |
DLIList< TBPoint * > & | points, | ||
CubitBoolean | allow_composites = CUBIT_FALSE |
||
) | const [protected] |
Definition at line 11820 of file GeometryModifyTool.cpp.
{ const int size = vertex_list.size(); DLIList<TopologyEntity*> topo_list(size); DLIList<TopologyBridge*> geom_list(size); GeometryModifyEngine* result; CAST_LIST_TO_PARENT( vertex_list, topo_list ); result = common_modify_engine( topo_list, geom_list, allow_composites ); CAST_LIST( geom_list, point_list, TBPoint ); return result; }
GeometryModifyEngine * GeometryModifyTool::common_modify_engine | ( | DLIList< TopologyEntity * > & | topology_list, |
DLIList< TopologyBridge * > & | engine_bridges, | ||
CubitBoolean | allow_composites = CUBIT_FALSE |
||
) | const [protected] |
Definition at line 11581 of file GeometryModifyTool.cpp.
{ GeometryModifyEngine* gme_ptr = 0; if(allow_composites) { int i; engine_bridges.clean_out(); for(i=topology_list.size(); i--;) { TopologyEntity* topo_ptr = topology_list.get_and_step(); if (!topo_ptr) return (GeometryModifyEngine*)NULL; TopologyBridge *first_bridge = topo_ptr->bridge_manager()->topology_bridge(); GeometryQueryEngine *gqe = first_bridge->get_geometry_query_engine(); DLIList<TopologyBridge*> underlying_bridge_list; gqe->get_underlying_bridges(first_bridge, underlying_bridge_list); if(underlying_bridge_list.size() == 0) underlying_bridge_list.append(first_bridge); int k; for(k=underlying_bridge_list.size(); k--;) { TopologyBridge *bridge_ptr = underlying_bridge_list.get_and_step(); engine_bridges.append( bridge_ptr ); GeometryModifyEngine *cur_gme = get_engine(bridge_ptr); if(!gme_ptr) gme_ptr = cur_gme; else { if(gme_ptr != cur_gme) { gme_ptr = NULL; k=0; i=0; } } } } } else { topology_list.reset(); TopologyEntity* topo_ptr = topology_list.get_and_step(); if (!topo_ptr) return (GeometryModifyEngine*)NULL; DLIList<TopologyBridge*> first_bridge_list; topo_ptr->bridge_manager()->get_bridge_list( first_bridge_list ); first_bridge_list.reset(); for( int i = first_bridge_list.size(); i > 0; i-- ) { TopologyBridge* bridge_ptr = first_bridge_list.get_and_step(); engine_bridges.clean_out(); engine_bridges.append( bridge_ptr ); gme_ptr = get_engine(bridge_ptr); if( !gme_ptr ) return (GeometryModifyEngine*)NULL; topology_list.reset(); topology_list.step(); //skip first entry for( int j = topology_list.size(); j > 1; j-- ) { topo_ptr = topology_list.get_and_step(); bridge_ptr = topo_ptr->bridge_manager()->topology_bridge(gme_ptr->get_gqe()); if( bridge_ptr ) engine_bridges.append( bridge_ptr ); else break; } if( engine_bridges.size() == topology_list.size() ) break; gme_ptr = 0; } } if( !gme_ptr ) { engine_bridges.clean_out(); PRINT_ERROR("Entities do not belong to the same geometry engine.\n"); } return gme_ptr; }
bool GeometryModifyTool::contains_composites | ( | DLIList< TopologyBridge * > & | bridge_list | ) | const |
Definition at line 10932 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> child_list; while (bridge_list.size()) { TopologyBridge* bridge = bridge_list.pop(); TBOwner* bridge_owner = bridge->owner(); if (bridge_owner && !dynamic_cast<BridgeManager*>(bridge_owner) && GeometryQueryTool::instance()->ige_is_composite(bridge_owner)) return true; child_list.clean_out(); bridge->get_children_virt(child_list); bridge_list += child_list; } return false; }
bool GeometryModifyTool::contains_composites | ( | DLIList< Body * > & | list | ) | const |
Definition at line 10923 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridges; list.reset(); for (int i = list.size(); i--; ) bridges.append(list.get_and_step()->get_body_sm_ptr()); return contains_composites(bridges); }
bool GeometryModifyTool::contains_intermediate_geom | ( | DLIList< Body * > & | list | ) | const [private] |
Definition at line 10878 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridges; list.reset(); for (int i = list.size(); i--; ) bridges.append(list.get_and_step()->get_body_sm_ptr()); return contains_intermediate_geom(bridges); }
bool GeometryModifyTool::contains_intermediate_geom | ( | DLIList< TopologyBridge * > & | list | ) | const [private] |
Definition at line 10896 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> child_list; while (bridge_list.size()) { TopologyBridge* bridge = bridge_list.pop(); TBOwner* bridge_owner = bridge->owner(); if (bridge_owner && !dynamic_cast<BridgeManager*>(bridge_owner)) return true; child_list.clean_out(); bridge->get_children_virt(child_list); bridge_list += child_list; } return false; }
bool GeometryModifyTool::contains_partitions | ( | DLIList< TopologyBridge * > & | bridge_list | ) | const |
Definition at line 10951 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> child_list; while (bridge_list.size()) { TopologyBridge* bridge = bridge_list.pop(); TBOwner* bridge_owner = bridge->owner(); if (bridge_owner && !dynamic_cast<BridgeManager*>(bridge_owner) && GeometryQueryTool::instance()->ige_is_partition(bridge_owner)) return true; child_list.clean_out(); bridge->get_children_virt(child_list); bridge_list += child_list; } return false; }
bool GeometryModifyTool::contains_partitions | ( | DLIList< Body * > & | list | ) | const |
Definition at line 10914 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridges; list.reset(); for (int i = list.size(); i--; ) bridges.append(list.get_and_step()->get_body_sm_ptr()); return contains_partitions(bridges); }
Body * GeometryModifyTool::copy_body | ( | Body * | body_ptr, |
std::map< RefEntity *, RefEntity * > * | old_to_new_map = NULL |
||
) |
Copy a Body.
Definition at line 2414 of file GeometryModifyTool.cpp.
{ BodySM* body_sm = bodyPtr->get_body_sm_ptr(); if (!body_sm) { PRINT_ERROR("Body %d is invalid -- no attached BodySM.\n", bodyPtr->id()); return 0; } //this list will get all the TB's what we'll be copying DLIList<RefEntity*> tmp_list; tmp_list.append( bodyPtr ); TopologyBridge *top_bridge; prepare_for_copy( bodyPtr, top_bridge ); BodySM *tmp_body_sm = CAST_TO( top_bridge, BodySM ); GeometryModifyEngine* GMEPtr = get_engine(tmp_body_sm); if ( GMEPtr == NULL ) { clean_up_from_copy_failure( top_bridge ); PRINT_ERROR("Cannot copy volume %d\n" " Copy is supported for bodies based on solid " "models only\n", bodyPtr->ref_volume()->id() ); return NULL ; } std::map<TopologyBridge*, TopologyBridge*> old_tb_to_new_tb; BodySM *new_bodysm = GMEPtr->copy_body(tmp_body_sm, &old_tb_to_new_tb ); if (!new_bodysm) { clean_up_from_copy_failure( top_bridge ); PRINT_ERROR("Failed to copy volume %d\n", bodyPtr->ref_volume()->id()); return 0; } TopologyBridge *top_bridge_new = new_bodysm; finish_copy( top_bridge_new, body_sm ); new_bodysm = CAST_TO( top_bridge_new, BodySM ); Body *body_new = GeometryQueryTool::instance()->make_Body(new_bodysm); if( old_to_new_map ) create_old_to_new_ref_ent_map( body_sm, new_bodysm, *old_to_new_map, old_tb_to_new_tb ); return body_new; }
RefEntity * GeometryModifyTool::copy_refentity | ( | RefEntity * | old_entity | ) |
Copy a RefEntity.
Takes a RefEntity (RefVertex, RefEdge, or RefFace) and creates a copy of it using the make_RefXxxxx commands.
Definition at line 8791 of file GeometryModifyTool.cpp.
{ RefEntity *new_entity = NULL; if( old_entity == NULL ) return (RefEntity*) NULL; if( CAST_TO( old_entity, RefVolume ) ) return (RefEntity*) NULL; RefFace *old_face = CAST_TO( old_entity, RefFace ); if( old_face ) { RefFace *new_face = instance()->make_RefFace( old_face ); new_entity = CAST_TO( new_face, RefEntity ); } RefEdge *old_edge = CAST_TO( old_entity, RefEdge ); if( old_edge ) { RefEdge *new_edge = instance()->make_RefEdge( old_edge ); new_entity = CAST_TO( new_edge, RefEntity ); } RefVertex *old_vert = CAST_TO( old_entity, RefVertex ); if( old_vert ) { RefVertex *new_vert = instance()->make_RefVertex( old_vert->coordinates() ); new_entity = CAST_TO( new_vert, RefEntity ); } return new_entity; }
RefEdge * GeometryModifyTool::create_arc | ( | const CubitVector & | position, |
double | radius, | ||
double | start_angle, | ||
double | end_angle, | ||
CubitVector | plane, | ||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Definition at line 11122 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } if( radius <= GEOMETRY_RESABS ) { PRINT_ERROR("Values must be positive\n"); return NULL; } if(preview) { gmeList.get()->create_arc(position,radius,start_angle,end_angle, plane, preview); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); Curve* curve = gmeList.get()->create_arc(position,radius,start_angle,end_angle, plane,preview); if (!curve) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); return 0; } RefEdge* result = GeometryQueryTool::instance()->make_free_RefEdge(curve); PRINT_INFO("Created curve %d\n", result->id()); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( result ); return result; }
RefEdge * GeometryModifyTool::create_arc_center_edge | ( | RefVertex * | ref_vertex1, |
RefVertex * | ref_vertex2, | ||
RefVertex * | ref_vertex3, | ||
const CubitVector & | normal, | ||
double | radius = CUBIT_DBL_MAX , |
||
CubitBoolean | full = CUBIT_FALSE , |
||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Create an arc curve from two points and a center point. If full option is specified, a full circle is created.
Create an arc curve from two points and a center point.
Definition at line 11436 of file GeometryModifyTool.cpp.
{ DLIList<TopologyEntity*> entity_list(3); DLIList<TopologyBridge*> bridge_list(3); entity_list.append(ref_vertex1); entity_list.append(ref_vertex2); entity_list.append(ref_vertex3); GeometryModifyEngine* gme = common_modify_engine(entity_list, bridge_list); if (!gme) { PRINT_ERROR("Vertices do not share a common modify engine.\n"); return 0; } if(preview) { TBPoint* point0 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(1)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(2)); gme->create_arc_center_edge( point0, point1, point2, normal, radius, full,preview ); return NULL; } //if we can reuse vertices, we decide here bool need_new_start_point=false, need_new_end_point=false; if( full ) { need_new_start_point = ref_vertex2->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); bridge_list.step(1); TBPoint *start_point = gme->make_Point( ref_vertex2->coordinates() ); bridge_list.change_to( start_point ); } } else { need_new_start_point = ref_vertex2->get_parents() > 0; need_new_end_point = ref_vertex3->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); bridge_list.step(); TBPoint *start_point = gme->make_Point( ref_vertex2->coordinates() ); bridge_list.change_to( start_point ); } if (need_new_end_point) { bridge_list.last(); TBPoint *end_point = gme->make_Point( ref_vertex3->coordinates()); bridge_list.change_to( end_point ); } } if( CubitUndo::get_undo_enabled() ) { DLIList<RefVertex*> vertices_to_save; if( !need_new_start_point ) vertices_to_save.append( ref_vertex2 ); if( !need_new_end_point ) vertices_to_save.append( ref_vertex3 ); if( vertices_to_save.size() ) CubitUndo::save_state_with_cubit_file( vertices_to_save, true ); else CubitUndo::save_state(); } bridge_list.reset(); TBPoint* point0 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(1)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(2)); Curve* curve = gme->create_arc_center_edge( point0, point1, point2, normal, radius, full ); if (!curve) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); return 0; } RefEdge* result = GeometryQueryTool::instance()->make_free_RefEdge(curve); PRINT_INFO("Created curve %d\n", result->id()); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( result ); return result; }
RefEdge * GeometryModifyTool::create_arc_radius | ( | RefVertex * | ref_vertex1, |
RefVertex * | ref_vertex2, | ||
const CubitVector & | normal, | ||
double | radius, | ||
CubitBoolean | other_arc = CUBIT_FALSE , |
||
CubitBoolean | full = CUBIT_FALSE , |
||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Definition at line 11305 of file GeometryModifyTool.cpp.
{ DLIList<TopologyEntity*> entity_list(2); DLIList<TopologyBridge*> bridge_list(2); entity_list.append(ref_vertex1); entity_list.append(ref_vertex2); GeometryModifyEngine* gme = common_modify_engine(entity_list, bridge_list); if (!gme) { PRINT_ERROR("Vertices do not share a common modify engine.\n"); return 0; } CubitVector start = ref_vertex1->coordinates(); // Position on arc CubitVector end = ref_vertex2->coordinates(); // Position on arc CubitVector center_vec=end-start; CubitVector perp_vec=normal*center_vec; center_vec*=0.5; double b=radius*radius-center_vec.length_squared(); if(b>=0) { b=sqrt(b); } else { PRINT_ERROR("Radius must be greater than half the distance between the end vertices.\n"); return 0; } if(other_arc) b*=-1; perp_vec.normalize(); perp_vec*=b; center_vec=center_vec+perp_vec; CubitVector center=start+center_vec; if(preview) { bridge_list.reset(); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(1)); gme->create_arc_radius(center,point1, point2, normal, radius, full,preview ); return NULL; } else { //if we can reuse vertices, we decide here bool need_new_start_point=false, need_new_end_point=false; if( full ) { need_new_start_point = ref_vertex1->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); TBPoint *start_point = gme->make_Point( ref_vertex1->coordinates() ); bridge_list.change_to( start_point ); } } else { need_new_start_point = ref_vertex1->get_parents() > 0; need_new_end_point = ref_vertex2->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); TBPoint *start_point = gme->make_Point( ref_vertex1->coordinates() ); bridge_list.change_to( start_point ); } if (need_new_end_point) { bridge_list.last(); TBPoint *end_point = gme->make_Point( ref_vertex2->coordinates()); bridge_list.change_to( end_point ); } } if( CubitUndo::get_undo_enabled() ) { DLIList<RefVertex*> vertices_to_save; if( !need_new_start_point ) vertices_to_save.append( ref_vertex1 ); if( !need_new_end_point ) vertices_to_save.append( ref_vertex2 ); if( vertices_to_save.size() ) CubitUndo::save_state_with_cubit_file( vertices_to_save, true ); else CubitUndo::save_state(); } bridge_list.reset(); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(1)); Curve* curve = gme->create_arc_radius(center,point1, point2, normal, radius, full,preview ); if (!curve) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); return 0; } RefEdge* result = GeometryQueryTool::instance()->make_free_RefEdge(curve); PRINT_INFO("Created curve %d\n", result->id()); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( result ); return result; } return 0; }
RefEdge * GeometryModifyTool::create_arc_three | ( | RefVertex * | ref_vertex1, |
RefVertex * | ref_vertex2, | ||
RefVertex * | ref_vertex3, | ||
CubitBoolean | full = CUBIT_FALSE , |
||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Create an arc curve from three points.
Definition at line 11170 of file GeometryModifyTool.cpp.
{ DLIList<TopologyEntity*> entity_list(3); DLIList<TopologyBridge*> bridge_list(3); entity_list.append(ref_vertex1); entity_list.append(ref_vertex2); entity_list.append(ref_vertex3); GeometryModifyEngine* gme = common_modify_engine(entity_list, bridge_list); if (!gme) { PRINT_ERROR("Vertices do not share a common solid modeller.\n"); return 0; } if(preview) { bridge_list.reset(); TBPoint* point0 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(1)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(2)); gme->create_arc_three( point0, point1, point2, full,preview ); return NULL; } //if we can reuse vertices, we decide here bool need_new_start_point = false; bool need_new_end_point = false; if( full ) { need_new_start_point = ref_vertex1->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); TBPoint *start_point = gme->make_Point( ref_vertex1->coordinates() ); bridge_list.change_to( start_point ); } } else { need_new_start_point = ref_vertex1->get_parents() > 0; need_new_end_point = ref_vertex3->get_parents() > 0; if (need_new_start_point) { bridge_list.reset(); TBPoint *start_point = gme->make_Point( ref_vertex1->coordinates() ); bridge_list.change_to( start_point ); } if (need_new_end_point) { bridge_list.reset(); bridge_list.last(); TBPoint *end_point = gme->make_Point( ref_vertex3->coordinates()); bridge_list.change_to( end_point ); } } if( CubitUndo::get_undo_enabled() ) { DLIList<RefVertex*> vertices_to_save; if( !need_new_start_point ) vertices_to_save.append( ref_vertex1 ); if( !need_new_end_point ) vertices_to_save.append( ref_vertex3 ); if( vertices_to_save.size() ) CubitUndo::save_state_with_cubit_file( vertices_to_save, true ); else CubitUndo::save_state(); } bridge_list.reset(); TBPoint* point0 = dynamic_cast<TBPoint*>(bridge_list.next(0)); TBPoint* point1 = dynamic_cast<TBPoint*>(bridge_list.next(1)); TBPoint* point2 = dynamic_cast<TBPoint*>(bridge_list.next(2)); Curve* curve = gme->create_arc_three( point0, point1, point2, full,preview ); if (!curve) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); return 0; } RefEdge* result = GeometryQueryTool::instance()->make_free_RefEdge(curve); PRINT_INFO("Created curve %d\n", result->id()); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( result ); return result; }
RefEdge * GeometryModifyTool::create_arc_three | ( | RefEdge * | ref_edge1, |
RefEdge * | ref_edge2, | ||
RefEdge * | ref_edge3, | ||
CubitBoolean | full = CUBIT_FALSE , |
||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Create an arc curve tangent to three curves.
Definition at line 11267 of file GeometryModifyTool.cpp.
{ DLIList<TopologyEntity*> entity_list(3); DLIList<TopologyBridge*> bridge_list(3); entity_list.append(ref_edge1); entity_list.append(ref_edge2); entity_list.append(ref_edge3); GeometryModifyEngine* gme = common_modify_engine(entity_list, bridge_list); if (!gme) { PRINT_ERROR("The input curves must be associated with a common solid modeller.\n"); return NULL; } bridge_list.reset(); Curve* curve0 = dynamic_cast<Curve*>(bridge_list.next(0)); Curve* curve1 = dynamic_cast<Curve*>(bridge_list.next(1)); Curve* curve2 = dynamic_cast<Curve*>(bridge_list.next(2)); Curve* curve = gme->create_arc_three( curve0, curve1, curve2, full,preview ); if (!curve) return 0; if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); RefEdge* result = GeometryQueryTool::instance()->make_free_RefEdge(curve); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( result ); PRINT_INFO("Created curve %d\n", result->id()); return result; }
Body * GeometryModifyTool::create_body | ( | VolumeFacets & | volume, |
std::map< FacetShapes *, RefEntity * > & | entity_map, | ||
const FacetPointSet & | points, | ||
int | interp_order | ||
) |
Creates a volume from facet data.
Creates a facet body based on facet information {volume} - topological and facet information of the volume and underlying entities {points} - a vector of doubles representing points used by the facets Returns the new Body or NULL
Definition at line 913 of file GeometryModifyTool.cpp.
{ GeometryModifyEngine* engine = gmeList.get(); if (!engine->supports_facets()) return NULL; Body* new_body = NULL; if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); std::map<FacetShapes*, GeometryEntity*> geom_entity_map; BodySM* body_sm = engine->create_body(volume, geom_entity_map, points, interp_order); if(body_sm) { new_body = GeometryQueryTool::instance()->make_Body(body_sm); // map information back to caller std::map<FacetShapes*, GeometryEntity*>::iterator geom_iter; for (geom_iter = geom_entity_map.begin(); geom_iter != geom_entity_map.end(); geom_iter++) entity_map[geom_iter->first] = dynamic_cast<RefEntity*>(geom_iter->second->topology_entity()); } if( CubitUndo::get_undo_enabled() ) { if( new_body ) CubitUndo::note_result_body( new_body ); else CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::create_circle_surface | ( | double | radius, |
CubitVector | plane | ||
) |
Definition at line 20939 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } if( radius <= GEOMETRY_RESABS ) { PRINT_ERROR("Values must be positive\n"); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); BodySM *sheet_body_sm = NULL; CubitStatus status = gmeList.get()->create_circle_surface(radius, plane, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::create_circle_surface | ( | RefVertex * | v1, |
RefVertex * | v2, | ||
RefVertex * | v3 | ||
) |
Definition at line 20984 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } GeometryModifyEngine *GMEPtr = get_engine( v1->get_point_ptr() ); if( GMEPtr != get_engine( v3->get_point_ptr() ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return NULL; } TBPoint *pt1, *pt3; DLIList<RefVertex*> free_ref_vertices; if( v1->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v1 ); pt1 = v1->get_point_ptr(); } else pt1 = GMEPtr->make_Point( v1->coordinates() ); if( v3->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v3 ); pt3 = v3->get_point_ptr(); } else pt3 = GMEPtr->make_Point( v3->coordinates() ); if( CubitUndo::get_undo_enabled() ) { if( free_ref_vertices.size() ) CubitUndo::save_state_with_cubit_file( free_ref_vertices, true ); else CubitUndo::save_state(); } BodySM *sheet_body_sm = NULL; CubitStatus status = GMEPtr->create_circle_surface(pt1, v2->coordinates(), pt3, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::create_circle_surface | ( | RefVertex * | v1, |
RefVertex * | v2, | ||
CubitVector | center_point | ||
) |
Definition at line 21058 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } GeometryModifyEngine *GMEPtr = get_engine( v1->get_point_ptr() ); if( GMEPtr != get_engine( v2->get_point_ptr() ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return NULL; } TBPoint *pt1, *pt2; DLIList<RefVertex*> free_ref_vertices; if( v1->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v1 ); pt1 = v1->get_point_ptr(); } else pt1 = GMEPtr->make_Point( v1->coordinates() ); if( v2->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v2 ); pt2 = v2->get_point_ptr(); } else pt2 = GMEPtr->make_Point( v2->coordinates() ); if( CubitUndo::get_undo_enabled() ) { if( free_ref_vertices.size() ) CubitUndo::save_state_with_cubit_file( free_ref_vertices, true ); else CubitUndo::save_state(); } BodySM *sheet_body_sm = NULL; CubitStatus status = GMEPtr->create_circle_surface(pt1, pt2, center_point, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
CubitStatus GeometryModifyTool::create_curve_combine | ( | DLIList< RefEdge * > & | ref_edge_list, |
RefEdge *& | new_ref_edge_ptr | ||
) |
Create a curve that is a combination of the specified curves.
Definition at line 11538 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridge_list(ref_edge_list.size()); CubitStatus result = CUBIT_FAILURE; int count = ref_edge_list.size(); if (count == 0) { PRINT_ERROR("No edges to combine.\n"); return result; } DLIList<TopologyEntity*> entity_list(count); CAST_LIST_TO_PARENT( ref_edge_list, entity_list ); GeometryModifyEngine* gme = common_modify_engine(entity_list, bridge_list); if (!gme) { PRINT_ERROR("Edges do not share a common modify engine.\n"); return result; } Curve* new_curve_ptr; DLIList<Curve*> curve_list(count); CAST_LIST( bridge_list, curve_list, Curve ); result = gme->create_curve_combine(curve_list, new_curve_ptr); if (new_curve_ptr) new_ref_edge_ptr = CAST_TO(new_curve_ptr->topology_entity(), RefEdge); return result; }
CubitStatus GeometryModifyTool::create_curve_helix | ( | CubitVector & | location, |
CubitVector & | direction, | ||
CubitVector & | start_point, | ||
double & | thread_distance, | ||
double & | angle, | ||
bool | right_handed, | ||
RefEdge *& | new_ref_edge_ptr | ||
) |
Definition at line 21252 of file GeometryModifyTool.cpp.
{ if (0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return CUBIT_FAILURE; } Curve *new_curve = gmeList.get()->create_curve_helix(location, direction, start_point, thread_distance, angle, right_handed ); if (new_curve == NULL) return CUBIT_FAILURE; if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); new_ref_edge_ptr = GeometryQueryTool::instance()->make_free_RefEdge(new_curve); if( CubitUndo::get_undo_enabled() ) CubitUndo::note_result_entity( new_ref_edge_ptr ); return CUBIT_SUCCESS; }
Body * GeometryModifyTool::create_ellipse_surface | ( | RefVertex * | v1, |
RefVertex * | v2, | ||
CubitVector | center_point | ||
) |
Definition at line 21132 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } GeometryModifyEngine *GMEPtr = get_engine( v1->get_point_ptr() ); if( GMEPtr != get_engine( v2->get_point_ptr() ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return NULL; } TBPoint *pt1, *pt2; DLIList<RefVertex*> free_ref_vertices; if( v1->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v1 ); pt1 = v1->get_point_ptr(); } else pt1 = GMEPtr->make_Point( v1->coordinates() ); if( v2->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v2 ); pt2 = v2->get_point_ptr(); } else pt2 = GMEPtr->make_Point( v2->coordinates() ); if( CubitUndo::get_undo_enabled() ) { if( free_ref_vertices.size() ) CubitUndo::save_state_with_cubit_file( free_ref_vertices, true ); else CubitUndo::save_state(); } BodySM *sheet_body_sm = NULL; CubitStatus status = GMEPtr->create_ellipse_surface(pt1, pt2, center_point, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::create_ellipse_surface | ( | double | major_radius, |
double | minor_radius, | ||
CubitVector | plane | ||
) |
Definition at line 21205 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } if( major_radius <= GEOMETRY_RESABS || minor_radius <= GEOMETRY_RESABS ) { PRINT_ERROR("Values must be positive\n"); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); BodySM *sheet_body_sm = NULL; CubitStatus status = gmeList.get()->create_ellipse_surface(major_radius, minor_radius, plane, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
CubitStatus GeometryModifyTool::create_net_surface | ( | DLIList< Surface * > & | ref_face_list, |
BodySM *& | new_body, | ||
DLIList< DLIList< CubitVector * > * > & | vec_lists_u, | ||
DLIList< DLIList< CubitVector * > * > & | vec_lists_v, | ||
double | net_tol = 1e-3 , |
||
CubitBoolean | heal = CUBIT_TRUE |
||
) |
Create a surface using arrays of points in u and v directions.
CubitStatus GeometryModifyTool::create_net_surface | ( | DLIList< RefEdge * > & | u_curves, |
DLIList< RefEdge * > & | v_curves, | ||
double | net_tol = 1e-3 , |
||
CubitBoolean | heal = CUBIT_TRUE |
||
) |
Create a surface using curves in u and v directions.
Definition at line 17428 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridge_list; DLIList<TopologyEntity*> entity_list; CAST_LIST_TO_PARENT( u_curves, entity_list ); GeometryModifyEngine* GME_ptr = common_modify_engine( entity_list, bridge_list ); if(! GME_ptr ) { PRINT_ERROR("Cannot construct a Surface using entities that do " "not share a common GeometryModifyEngine.\n"); return CUBIT_FAILURE; } DLIList<Curve*> curves_in_u(bridge_list.size()); CAST_LIST( bridge_list, curves_in_u, Curve ); bridge_list.clean_out(); entity_list.clean_out(); CAST_LIST_TO_PARENT( v_curves, entity_list ); GeometryModifyEngine* dummy_GME_ptr = common_modify_engine( entity_list, bridge_list ); if(! dummy_GME_ptr || dummy_GME_ptr != GME_ptr ) { PRINT_ERROR("Cannot construct a Surface using entities that do " "not share a common GeometryModifyEngine.\n"); return CUBIT_FAILURE; } DLIList<Curve*> curves_in_v(bridge_list.size()); CAST_LIST( bridge_list, curves_in_v, Curve ); BodySM *new_smbody = NULL; if( !GME_ptr->create_net_surface( curves_in_u, curves_in_v, new_smbody, net_tol, heal ) ) return CUBIT_FAILURE; if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); Body* new_body = NULL; new_body = GeometryQueryTool::instance()->make_Body( new_smbody ); if( new_body ) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); return CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } }
CubitStatus GeometryModifyTool::create_offset_body | ( | Body * | body_ptr, |
Body *& | new_body, | ||
double | offset_distance | ||
) |
Create a body by offsetting all the surface of the body.
Definition at line 17736 of file GeometryModifyTool.cpp.
{ GeometryModifyEngine* GMEPtr = get_engine(body_ptr); BodySM *body_sm = body_ptr->get_body_sm_ptr(); if (!body_sm) { PRINT_ERROR("Body %d is invalid -- no attached BodySM.\n", body_ptr->id()); return CUBIT_FAILURE; } BodySM *new_body_sm; if( !GMEPtr->create_offset_body( body_sm, new_body_sm, offset_distance ) ) return CUBIT_FAILURE; if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); new_body = GeometryQueryTool::instance()->make_Body( new_body_sm ); if( new_body ) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); return CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } }
CubitStatus GeometryModifyTool::create_offset_sheet | ( | DLIList< RefFace * > & | ref_face_list, |
double | offset_distance, | ||
DLIList< RefFace * > * | add_ref_face_list_ptr, | ||
DLIList< double > * | add_offset_list_ptr, | ||
DLIList< Body * > & | new_body_list, | ||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Create a body(s) by offsetting the given surfaces.
Create a sheet body (or bodies) by offsetting the given faces. The optional additional face list and double list (must be same length) allow different offset distances for different faces. Adjoining faces are extended or trimmed to remain joined in the new sheet body. Radial faces that cannot be so offset are removed and the resulting wound healed by the surrounding faces.
Definition at line 17537 of file GeometryModifyTool.cpp.
{ if( !ref_face_list.size() ) { return CUBIT_SUCCESS; } else { for (int i = 0; i < ref_face_list.size(); i++) { RefFace *temp = ref_face_list.get_and_step(); if (temp->get_surface_ptr()->is_cylindrical() == 16) { DLIList<Curve*> curves; CubitVector loc; double rad; temp->get_surface_ptr()->curves(curves); curves.reset(); int j = 0; while (curves.get()->geometry_type() != ELLIPSE_CURVE_TYPE && curves.get()->geometry_type() != ARC_CURVE_TYPE) { curves.step(); if (j == curves.size()) { break; } j++; } curves.get()->get_center_radius(loc, rad); if (offset_distance >= rad) { CubitVector norm, close, result; double angle; temp->get_surface_ptr()->closest_point(loc, &close, &norm); result.set(loc.x()-close.x(), loc.y()-close.y(), loc.z()-close.z()); angle = result.interior_angle(norm); if (angle < GEOMETRY_RESABS && angle > -GEOMETRY_RESABS) { PRINT_ERROR("Offset is greater than the radius of curvature for surface %i.\n", temp->id()); PRINT_WARNING("No body will be created for surface %i.\n", temp->id()); if (ref_face_list.size() > 1) { ref_face_list.remove_all_with_value(temp); } else { return CUBIT_FAILURE; } } } } } for (int i = 0; i < add_ref_face_list_ptr->size(); i++) { RefFace *temp = ref_face_list.get_and_step(); if (temp->get_surface_ptr()->is_cylindrical() == 16) { DLIList<Curve*> curves; CubitVector loc; double rad; temp->get_surface_ptr()->curves(curves); curves.reset(); while (curves.get()->geometry_type() != ELLIPSE_CURVE_TYPE && curves.get()->geometry_type() != ARC_CURVE_TYPE) { curves.step(); } curves.get()->get_center_radius(loc, rad); if (offset_distance >= rad) { CubitVector norm, close, result; double angle; temp->get_surface_ptr()->closest_point(loc, &close, &norm); result.set(loc.x()-close.x(), loc.y()-close.y(), loc.z()-close.z()); angle = result.interior_angle(norm); if (angle < GEOMETRY_RESABS && angle > -GEOMETRY_RESABS) { PRINT_ERROR("Offset is greater than the radius of curvature for surface %i.\n", temp->id()); PRINT_WARNING("No body will be created for surface %i.\n", temp->id()); add_ref_face_list_ptr->remove_all_with_value(temp); } } } } } DLIList<RefFace*> all_ref_face_list(ref_face_list.size()); all_ref_face_list = ref_face_list; if( add_ref_face_list_ptr->size() ) all_ref_face_list += *add_ref_face_list_ptr; // Check for virtual geometry DLIList<RefEntity*> ref_ent_list; CAST_LIST_TO_PARENT(all_ref_face_list, ref_ent_list); if ( GeometryQueryTool::instance()->contains_intermediate_geometry(ref_ent_list) ) { PRINT_ERROR("OFFSETTING surfaces containing virtual geometry is not\n" " allowed. Delete virtual geometry on these surfaces\n" " before operation.\n" ); return CUBIT_FAILURE; } // Look for a common GeometryModifyEngine for all of the RefFaces int count = all_ref_face_list.size(); DLIList<TopologyBridge*> bridge_list(count); DLIList<TopologyEntity*> entity_list(count); CAST_LIST_TO_PARENT( all_ref_face_list, entity_list ); GeometryModifyEngine* GME_ptr = common_modify_engine( entity_list, bridge_list ); if(! GME_ptr ) { PRINT_ERROR("Cannot construct offset sheet(s) using surfaces that\n" " do not share a common geometry engine.\n"); return CUBIT_FAILURE; } // Get Surfaces from the RefFaces DLIList<Surface*> surface_list(ref_face_list.size()); int i; RefFace *ref_face_ptr; for( i=ref_face_list.size(); i--; ) { ref_face_ptr = ref_face_list.get_and_step(); surface_list.append( ref_face_ptr->get_surface_ptr() ); } DLIList<Surface*> add_surf_list; if( add_ref_face_list_ptr->size() ) { for( i=add_ref_face_list_ptr->size(); i--; ) { ref_face_ptr = add_ref_face_list_ptr->get_and_step(); add_surf_list.append( ref_face_ptr->get_surface_ptr() ); } } if (CubitUndo::get_undo_enabled() && !preview ) CubitUndo::save_state(); CubitStatus status; DLIList<BodySM*> BodySM_list; if( add_surf_list.size() ) { status = GME_ptr->create_offset_sheet( surface_list, offset_distance, &add_surf_list, add_offset_list_ptr, BodySM_list, preview ); } else { status = GME_ptr->create_offset_sheet( surface_list, offset_distance, NULL, NULL, BodySM_list, preview ); } if( status == CUBIT_FAILURE || !BodySM_list.size() ) { if(CubitUndo::get_undo_enabled() && !preview ) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } BodySM *bodysm_ptr; Body* body_ptr; for( i=BodySM_list.size(); i--; ) { DLIList<Surface*> surfs; bodysm_ptr = BodySM_list.get_and_step(); bodysm_ptr->surfaces(surfs); if (!surfs.size()) { PRINT_WARNING("Empty body created. Body deleted.\n"); PRINT_WARNING("Empty body likely due to an offset larger than the radius of curvature of a surface.\n"); bodysm_ptr->get_geometry_query_engine()->delete_solid_model_entities(bodysm_ptr); break; } body_ptr = GeometryQueryTool::instance()->make_Body( bodysm_ptr ); if( body_ptr ) new_body_list.append( body_ptr ); } if( new_body_list.size() ) { if(CubitUndo::get_undo_enabled() && !preview ) CubitUndo::note_result_bodies(new_body_list); return CUBIT_SUCCESS; } else { if(CubitUndo::get_undo_enabled() && !preview ) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } }
CubitStatus GeometryModifyTool::create_offset_surface | ( | RefFace * | ref_face_ptr, |
double | offset_distance | ||
) |
Creates an offset surface some distance from a surface.
Definition at line 17488 of file GeometryModifyTool.cpp.
{ TopologyBridge *bridge_ptr = NULL; GeometryModifyEngine* GMEPtr = get_engine(ref_face_ptr, &bridge_ptr ); Surface *tmp_surf = NULL; tmp_surf = CAST_TO( bridge_ptr, Surface ); BodySM *new_smbody; if( !GMEPtr->create_offset_surface( tmp_surf, new_smbody, offset_distance ) ) return CUBIT_FAILURE; if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); Body* new_body = NULL; new_body = GeometryQueryTool::instance()->make_Body( new_smbody ); if( new_body ) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); return CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } }
CubitStatus GeometryModifyTool::create_old_to_new_ref_ent_map | ( | TopologyBridge * | old_top_level_bridge, |
TopologyBridge * | new_top_level_bridge, | ||
std::map< RefEntity *, RefEntity * > & | old_to_new_map, | ||
std::map< TopologyBridge *, TopologyBridge * > & | old_tb_to_new_tb | ||
) | [static, private] |
Definition at line 21675 of file GeometryModifyTool.cpp.
{ std::vector< std::pair<TopologyBridge*, TopologyBridge*> > unmatched_pairs; bool debug = false; std::map< TopologyBridge*, TopologyBridge*>::iterator iter; //This first loop tries to find a RefEntity on each TopologyBridge pair in the //map 'old_tb_to_new_tb'. If there is no virtual geometry here, everything //should be found. If it didn't find a RefEntity, put it in the //unmatched_pairs vector. for( iter = old_tb_to_new_tb.begin(); iter!=old_tb_to_new_tb.end(); iter++ ) { std::pair<TopologyBridge*, TopologyBridge*> tmp_pair = *iter; TopologyBridge *old_tb = tmp_pair.first; TopologyBridge *new_tb = tmp_pair.second; TopologyEntity *te_old = old_tb->topology_entity(); TopologyEntity *te_new = new_tb->topology_entity(); if( te_old && te_new ) { RefEntity *old_ref_ent = dynamic_cast<RefEntity*>(te_old); RefEntity *new_ref_ent = dynamic_cast<RefEntity*>(te_new); if( old_ref_ent && new_ref_ent ) { if( debug ) PRINT_INFO("%s %d ---> %s %d\n", old_ref_ent->class_name(), old_ref_ent->id(), new_ref_ent->class_name(), new_ref_ent->id() ); old_to_new_map.insert( std::make_pair( old_ref_ent, new_ref_ent ) ); } else unmatched_pairs.push_back( tmp_pair ); } else unmatched_pairs.push_back( tmp_pair ); } //Virtual geometry will be in unmatched pairs. Composite will have an n-to-1 //TB-to-RefEntity mapping. So it might try to stuff duplicate pairs into the //map, but that's alright. for( size_t k=0; k<unmatched_pairs.size(); k++ ) { std::pair<TopologyBridge*, TopologyBridge*> tmp_pair = unmatched_pairs[k]; TopologyBridge *old_tb = tmp_pair.first; TopologyBridge *new_tb = tmp_pair.second; //get the owner tbs associate with old_tb DLIList<TopologyBridge*> old_owner_tbs; GeometryQueryTool::instance()->get_tbs_with_bridge_manager_as_owner( old_tb, old_owner_tbs ); DLIList<TopologyBridge*> new_owner_tbs; GeometryQueryTool::instance()->get_tbs_with_bridge_manager_as_owner( new_tb, new_owner_tbs ); if( old_owner_tbs.size() && old_owner_tbs.size() == new_owner_tbs.size() ) { if( old_owner_tbs.size() == 1 && new_owner_tbs.size() == 1 ) //composite case { TopologyEntity *te_old = old_owner_tbs.get()->topology_entity(); TopologyEntity *te_new = new_owner_tbs.get()->topology_entity(); if( te_old && te_new ) { RefEntity *old_ref_ent = dynamic_cast<RefEntity*>(te_old); RefEntity *new_ref_ent = dynamic_cast<RefEntity*>(te_new); if( old_ref_ent && new_ref_ent ) { if( debug ) PRINT_INFO("Virtual: %s %d ---> %s %d\n", old_ref_ent->class_name(), old_ref_ent->id(), new_ref_ent->class_name(), new_ref_ent->id() ); old_to_new_map.insert( std::make_pair( old_ref_ent, new_ref_ent ) ); old_tb_to_new_tb.insert( std::make_pair( old_owner_tbs.get(), new_owner_tbs.get() ) ); } } } } } //Partitions can hide entities because of the the n-to-m mapping. //The solution is to get all the child TB lumps, surface, curves, and //points. double tol_sq = old_top_level_bridge->get_geometry_query_engine()->get_sme_resabs_tolerance(); tol_sq *= tol_sq; DLIList<Lump*> old_lumps, new_lumps; DLIList<Surface*> old_surfaces, new_surfaces; DLIList<Curve*> old_curves, new_curves; DLIList<TBPoint*> old_points, new_points; if( dynamic_cast<BodySM*>(old_top_level_bridge) ) { old_top_level_bridge->lumps( old_lumps ); old_top_level_bridge->surfaces( old_surfaces ); new_top_level_bridge->lumps( new_lumps ); new_top_level_bridge->surfaces( new_surfaces ); } old_top_level_bridge->curves( old_curves ); old_top_level_bridge->points( old_points ); new_top_level_bridge->curves( new_curves ); new_top_level_bridge->points( new_points ); //If it is already in the map, it has been paired to something. //Remove it from the list and forget about it. for( int k=0; k<old_lumps.size(); k++ ) { //if it is found, make it NULL in the list iter = old_tb_to_new_tb.find( old_lumps[k] ); if( iter != old_tb_to_new_tb.end() ) { old_lumps[k] = NULL; if( new_lumps.move_to( (Lump*)iter->second ) ) new_lumps.change_to( NULL ); } } for( int k=0; k<old_surfaces.size(); k++ ) { //if it is found, make it NULL in the list iter = old_tb_to_new_tb.find( old_surfaces[k] ); if( iter != old_tb_to_new_tb.end() ) { old_surfaces[k] = NULL; if( new_surfaces.move_to( (Surface*)iter->second ) ) new_surfaces.change_to( NULL ); } } for( int k=0; k<old_curves.size(); k++ ) { //if it is found, make it NULL in the list iter = old_tb_to_new_tb.find( old_curves[k] ); if( iter != old_tb_to_new_tb.end() ) { old_curves[k] = NULL; if( new_curves.move_to( (Curve*)iter->second ) ) new_curves.change_to( NULL ); } } for( int k=0; k<old_points.size(); k++ ) { //if it is found, make it NULL in the list iter = old_tb_to_new_tb.find( old_points[k] ); if( iter != old_tb_to_new_tb.end() ) { old_points[k] = NULL; if( new_points.move_to( (TBPoint*)iter->second ) ) new_points.change_to( NULL ); } } //Remove all the NULL-ed out stuff old_lumps.remove_all_with_value(NULL); old_surfaces.remove_all_with_value(NULL); old_curves.remove_all_with_value(NULL); old_points.remove_all_with_value(NULL); new_lumps.remove_all_with_value(NULL); new_surfaces.remove_all_with_value(NULL); new_curves.remove_all_with_value(NULL); new_points.remove_all_with_value(NULL); //should have exact correspondence if( old_lumps.size() != new_lumps.size() ) return CUBIT_FAILURE; if( old_surfaces.size() != new_surfaces.size() ) return CUBIT_FAILURE; if( old_curves.size() != new_curves.size() ) return CUBIT_FAILURE; if( old_points.size() != new_points.size() ) return CUBIT_FAILURE; //If we are here, there are partitions we have to resolve. The only way to do it //is a brute force approach. It's save to use a tolerance since we know the //entities will be exactly on top of each other. for( int k=0; k<old_surfaces.size(); k++ ) { Surface *old_surf = old_surfaces[k]; CubitBox old_bbox = old_surf->bounding_box(); for( int j=0; j<new_surfaces.size(); j++ ) { Surface *new_surf = new_surfaces[j]; if( new_surf ) { CubitBox new_bbox = new_surf->bounding_box(); if( old_bbox.center().distance_between_squared( new_bbox.center() ) < tol_sq ) { if( fabs(old_bbox.diagonal().length_squared() - new_bbox.diagonal().length_squared() ) < tol_sq ) { TopologyEntity *te_old = old_surf->topology_entity(); TopologyEntity *te_new = new_surf->topology_entity(); if( te_old && te_new ) { RefEntity *old_ref_ent = dynamic_cast<RefEntity*>(te_old); RefEntity *new_ref_ent = dynamic_cast<RefEntity*>(te_new); if( old_ref_ent && new_ref_ent ) { if( debug ) PRINT_INFO("Partition: %s %d ---> %s %d\n", old_ref_ent->class_name(), old_ref_ent->id(), new_ref_ent->class_name(), new_ref_ent->id() ); old_to_new_map.insert( std::make_pair( old_ref_ent, new_ref_ent ) ); new_surfaces[j] = NULL; break; } } } } } } } //Curves for( int k=0; k<old_curves.size(); k++ ) { Curve *old_curve = old_curves[k]; CubitBox old_bbox = old_curve->bounding_box(); for( int j=0; j<new_curves.size(); j++ ) { Curve *new_curve = new_curves[j]; if( new_curve ) { CubitBox new_bbox = new_curve->bounding_box(); if( old_bbox.center().distance_between_squared( new_bbox.center() ) < tol_sq ) { if( fabs(old_bbox.diagonal().length_squared() - new_bbox.diagonal().length_squared() ) < tol_sq ) { TopologyEntity *te_old = old_curve->topology_entity(); TopologyEntity *te_new = new_curve->topology_entity(); if( te_old && te_new ) { RefEntity *old_ref_ent = dynamic_cast<RefEntity*>(te_old); RefEntity *new_ref_ent = dynamic_cast<RefEntity*>(te_new); if( old_ref_ent && new_ref_ent ) { if( debug ) PRINT_INFO("Partition: %s %d ---> %s %d\n", old_ref_ent->class_name(), old_ref_ent->id(), new_ref_ent->class_name(), new_ref_ent->id() ); old_to_new_map.insert( std::make_pair( old_ref_ent, new_ref_ent ) ); new_curves[j] = NULL; break; } } } } } } } //Points for( int k=0; k<old_points.size(); k++ ) { TBPoint *old_point = old_points[k]; CubitBox old_bbox = old_point->bounding_box(); for( int j=0; j<new_points.size(); j++ ) { TBPoint *new_point = new_points[j]; if( new_point ) { CubitBox new_bbox = new_point->bounding_box(); if( old_bbox.center().distance_between_squared( new_bbox.center() ) < tol_sq ) { if( fabs(old_bbox.diagonal().length_squared() - new_bbox.diagonal().length_squared() ) < tol_sq ) { TopologyEntity *te_old = old_point->topology_entity(); TopologyEntity *te_new = new_point->topology_entity(); if( te_old && te_new ) { RefEntity *old_ref_ent = dynamic_cast<RefEntity*>(te_old); RefEntity *new_ref_ent = dynamic_cast<RefEntity*>(te_new); if( old_ref_ent && new_ref_ent ) { if( debug ) PRINT_INFO("Partition: %s %d ---> %s %d\n", old_ref_ent->class_name(), old_ref_ent->id(), new_ref_ent->class_name(), new_ref_ent->id() ); old_to_new_map.insert( std::make_pair( old_ref_ent, new_ref_ent ) ); new_points[j] = NULL; break; } } } } } } } return CUBIT_SUCCESS; }
Body * GeometryModifyTool::create_parallelogram_surface | ( | RefVertex * | v1, |
RefVertex * | v2, | ||
RefVertex * | v3 | ||
) |
Definition at line 20853 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } GeometryModifyEngine *GMEPtr = get_engine( v1->get_point_ptr() ); if( GMEPtr != get_engine( v2->get_point_ptr() ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return NULL; } if( GMEPtr != get_engine( v3->get_point_ptr() ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return NULL; } TBPoint *pt1, *pt2, *pt3; DLIList<RefVertex*> free_ref_vertices; if( v1->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v1 ); pt1 = v1->get_point_ptr(); } else pt1 = GMEPtr->make_Point( v1->coordinates() ); if( v2->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v2 ); pt2 = v2->get_point_ptr(); } else pt2 = GMEPtr->make_Point( v2->coordinates() ); if( v3->num_parent_ref_entities() == 0 ) { free_ref_vertices.append( v3 ); pt3 = v3->get_point_ptr(); } else pt3 = GMEPtr->make_Point( v3->coordinates() ); if( CubitUndo::get_undo_enabled() ) { if( free_ref_vertices.size() ) CubitUndo::save_state_with_cubit_file( free_ref_vertices, true ); else CubitUndo::save_state(); } BodySM *sheet_body_sm = NULL; CubitStatus status = GMEPtr->create_parallelogram_surface(pt1, pt2, pt3, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } return new_body; }
Body * GeometryModifyTool::create_rectangle_surface | ( | double | width, |
double | height, | ||
CubitVector | plane | ||
) |
Definition at line 20806 of file GeometryModifyTool.cpp.
{ if(0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } if( width <= GEOMETRY_RESABS || height <= GEOMETRY_RESABS ) { PRINT_ERROR("Values must be positive\n"); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); BodySM *sheet_body_sm = NULL; CubitStatus status = gmeList.get()->create_rectangle_surface(width, height, plane, sheet_body_sm ); if( status == CUBIT_FAILURE ) { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return NULL; } Body *new_body = NULL; if( sheet_body_sm ) new_body = GeometryQueryTool::instance()->make_Body(sheet_body_sm); if (new_body) { if(CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); status = CUBIT_SUCCESS; } else { if(CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); status = CUBIT_FAILURE; } return new_body; }
CubitStatus GeometryModifyTool::create_skin_surface | ( | DLIList< RefEdge * > & | ref_edges, |
Body *& | new_body, | ||
DLIList< RefEdge * > & | guides | ||
) |
Create a sheet body skinning (lofting) a series of curves.
Definition at line 17773 of file GeometryModifyTool.cpp.
{ DLIList<TopologyBridge*> bridge_list; DLIList<TopologyEntity*> entity_list; CAST_LIST_TO_PARENT( ref_edges, entity_list ); DLIList<TopologyBridge*> guide_bridge_list; DLIList<TopologyEntity*> guide_entity_list; CAST_LIST_TO_PARENT(guides, guide_entity_list); if (ref_edges.size() < 2) { PRINT_ERROR("Must specify at least 2 curves to create a skinned surface.\n"); return CUBIT_FAILURE; } GeometryModifyEngine* GME_ptr = common_modify_engine( entity_list, bridge_list ); if(! GME_ptr ) { PRINT_ERROR("Cannot construct a Surface using entities that do " "not share a common GeometryModifyEngine.\n"); return CUBIT_FAILURE; } if (guides.size() > 0) { GeometryModifyEngine* GME_ptr2 = common_modify_engine( guide_entity_list, guide_bridge_list ); if (GME_ptr != GME_ptr2) { PRINT_ERROR("Performing create skin with geometry from\n" "different modeling engines is not allowed.\n"); return CUBIT_FAILURE; } } DLIList<Curve*> curves_to_skin(bridge_list.size()); CAST_LIST( bridge_list, curves_to_skin, Curve ); DLIList<Curve*> guide_curves(guide_bridge_list.size()); CAST_LIST(guide_bridge_list, guide_curves, Curve); BodySM *new_body_sm = NULL; if( !GME_ptr->create_skin_surface( curves_to_skin, new_body_sm, guide_curves ) ) return CUBIT_FAILURE; if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); new_body = NULL; new_body = GeometryQueryTool::instance()->make_Body( new_body_sm ); if( new_body ) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); return CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } }
CubitStatus GeometryModifyTool::create_solid_bodies_from_surfs | ( | DLIList< RefFace * > & | ref_face_list, |
DLIList< Body * > & | new_bodies, | ||
CubitBoolean | keep_old = CUBIT_FALSE , |
||
CubitBoolean | heal = CUBIT_TRUE , |
||
CubitBoolean | sheet = CUBIT_FALSE |
||
) | const |
Creates a body out of the specified surfaces.
Creates a body out of the surfaces in the ref_face_list. The surfaces can be either free surfaces or sheet bodies or both. The body should be healed. The bounding curves and vertices between the surfaces must be within tolerance.
Definition at line 10741 of file GeometryModifyTool.cpp.
{ //First check to make sure the data is all here. for ( int ii = ref_face_list.size(); ii > 0; ii-- ) { RefFace *ref_face = ref_face_list.get_and_step(); DLIList<Body*> bodies; ref_face->bodies(bodies); if ( bodies.size() > 1 ) { PRINT_ERROR("Can't create a volume with %s (surface %d) is attached to more\n" "than one volume, or if the attached body is not a sheet body.\n", ref_face->entity_name().c_str(), ref_face->id()); return CUBIT_FAILURE; } else if ( bodies.size() == 1 ) { if (!bodies.get()->is_sheet_body()) { PRINT_ERROR("Can't create a volume with %s (surface %d), it is\n" "attached to a body that is not a sheet body.\n", ref_face->entity_name().c_str(), ref_face->id()); return CUBIT_FAILURE; } } } DLIList<TopologyEntity*> entity_list(ref_face_list.size()); DLIList<TopologyBridge*> bridge_list(ref_face_list.size()); DLIList<Surface*> surface_list(ref_face_list.size()); GeometryModifyEngine* gme; CAST_LIST_TO_PARENT(ref_face_list, entity_list); gme = common_modify_engine(entity_list, bridge_list); CAST_LIST(bridge_list, surface_list, Surface); if (!gme) { PRINT_ERROR("Surfaces do not share a common modify engine.\n"); return CUBIT_FAILURE; } DLIList<TopologyEntity*> query_output, query_input(ref_face_list.size()); DLIList<Body*> body_list; CAST_LIST_TO_PARENT(ref_face_list, query_input); ModelQueryEngine::instance()-> query_model( query_input, DagType::body_type(), query_output ); CAST_LIST( query_output, body_list, Body ); int i; DLIList<RefFace*> free_face_list; for ( i=ref_face_list.size(); i--; ) { RefFace* ref_face = ref_face_list.get_and_step(); query_output.clean_out(); ModelQueryEngine::instance()-> query_model( *ref_face, DagType::body_type(), query_output ); if (!query_output.size()) free_face_list.append(ref_face); } if (CubitUndo::get_undo_enabled()) CubitUndo::save_state_with_cubit_file(ref_face_list); //get all the bodysm's DLIList<BodySM*> old_body_sm_list; for( i=body_list.size(); i--; ) { Body *tmp_body = body_list.get_and_step(); TopologyBridge *tb = tmp_body->bridge_manager()->topology_bridge(); BodySM *tmp_body_sm = CAST_TO(tb, BodySM); if( tmp_body_sm ) old_body_sm_list.append( tmp_body_sm ); } // TODO: do I need a clear and a flush here? --KGM GeometryModifyTool::instance()->do_attribute_setup(); GeometryModifyTool::instance()->push_attributes_before_modify(old_body_sm_list); DLIList<BodySM*> new_bodies_sm; CubitStatus stat = gme->create_solid_bodies_from_surfs( surface_list, new_bodies_sm, keep_old, heal, sheet ); DLIList<BodySM*> body_sm_list; for ( i=new_bodies_sm.size(); i--; ) body_sm_list.append( new_bodies_sm.get_and_step() ); GeometryModifyTool::instance()->restore_vg_after_modify(new_bodies_sm, body_list, gme); GeometryModifyTool::instance()->remove_pushed_attributes(new_bodies_sm, body_list); if (!finish_sm_op( body_list, body_sm_list, new_bodies)) { stat = CUBIT_FAILURE; if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } else { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_bodies(new_bodies); } GeometryModifyTool::instance()->do_attribute_cleanup(); DLIList<int> id_list (free_face_list.size()); while (free_face_list.size()) { RefFace* ref_face = free_face_list.pop(); if (!ref_face->get_surface_ptr()) { id_list.append(ref_face->id()); GeometryQueryTool::instance()-> destroy_dead_entity( ref_face ); } } GeometryQueryTool::instance()->cleanout_deactivated_geometry(); if (id_list.size()) CubitUtil::list_entity_ids( "Destroyed surface(s) ", id_list ); //new_body = new_body_list.size() ? new_body_list.get() : 0; return stat; }
CubitStatus GeometryModifyTool::create_surface | ( | DLIList< CubitVector * > & | vec_list, |
Body *& | new_body, | ||
RefFace * | ref_face_ptr, | ||
CubitBoolean | project_points | ||
) |
Fits an analytic spline surface through positions.
Fits an analytic spline surface through positions. If a surface is specified, positions are forced to lie on the surface and restrains the resultant surface geometry to match the surface's geometry. The project parameter will project the nodes or vertices to the specified surface.
Definition at line 18211 of file GeometryModifyTool.cpp.
{ GeometryModifyEngine* GMEPtr = gmeList.get(); if( ref_face_ptr ) { if( GMEPtr != get_engine(ref_face_ptr) ) { PRINT_ERROR("Geometry engine of Surface %d is not the active geometry engine.\n", ref_face_ptr->id() ); PRINT_INFO(" Use command \"Set Geometry Engine ...\" to set to correct engine.\n"); return CUBIT_FAILURE; } } BodySM* body_sm = NULL; Surface *project_to_surface = NULL; if( ref_face_ptr ) project_to_surface = ref_face_ptr->get_surface_ptr(); CubitStatus stat = GMEPtr->create_surface( vec_list, body_sm, project_to_surface, project_points ); if( stat == CUBIT_FAILURE ) return stat; if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); if( body_sm ) new_body = GeometryQueryTool::instance()->make_Body(body_sm); if (new_body) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); stat = CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); stat = CUBIT_FAILURE; } return stat; }
CubitStatus GeometryModifyTool::create_surface | ( | DLIList< RefVertex * > & | vert_list, |
Body *& | new_body, | ||
RefFace * | on_surface = NULL |
||
) |
Definition at line 18113 of file GeometryModifyTool.cpp.
{ //determine which vertices are free and which are not... //copy ones that are not vert_list.reset(); DLIList<TBPoint*> points; GeometryModifyEngine *GMEPtr = get_engine( vert_list.get()->get_point_ptr() ); DLIList<RefVertex*> free_ref_vertices; int i; for( i=vert_list.size(); i--; ) { RefVertex *tmp_vert = vert_list.get_and_step(); if( tmp_vert->num_parent_ref_entities() == 0 ) free_ref_vertices.append( tmp_vert ); TBPoint *tmp_point = tmp_vert->get_point_ptr(); if( GMEPtr != get_engine( tmp_point ) ) { PRINT_INFO("Vertices are not from same modeling engine.\n"); return CUBIT_FAILURE; } if( tmp_vert->get_parents() == 0 ) { points.append( tmp_point ); } else { TBPoint *new_point = GMEPtr->make_Point( tmp_vert->coordinates() ); points.append( new_point ); } } if( on_surface ) { if( GMEPtr != get_engine( on_surface->get_surface_ptr() ) ) { PRINT_INFO("Surface and Vertices are not from same modeling engine.\n"); return CUBIT_FAILURE; } } if(CubitUndo::get_undo_enabled()) { if( free_ref_vertices.size() ) CubitUndo::save_state_with_cubit_file( free_ref_vertices ); else CubitUndo::save_state(); } BodySM* body_sm = NULL; Surface *on_surf = NULL; if( on_surface ) on_surf = on_surface->get_surface_ptr(); CubitStatus stat = GMEPtr->create_surface( points, body_sm, on_surf ); if( stat == CUBIT_FAILURE ) { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); return stat; } if( body_sm ) new_body = GeometryQueryTool::instance()->make_Body(body_sm); if (new_body) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); stat = CUBIT_SUCCESS; } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); stat = CUBIT_FAILURE; } for( i=free_ref_vertices.size(); i--; ) { RefVertex *free_vertex = free_ref_vertices.get_and_step(); AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOP_LEVEL_ENTITY_DESTRUCTED, free_vertex)); CGMHistory::Event evt(CGMHistory::TOP_LEVEL_ENTITY_DELETED, free_vertex ); GeometryQueryTool::instance()->history().add_event(evt); } return stat; }
CubitStatus GeometryModifyTool::create_surface_curve | ( | DLIList< RefEntity * > | curve_entity, |
DLIList< RefEntity * > | target_entity, | ||
CubitVector | sweep_direction = CubitVector(0, 0, 0) , |
||
CubitBoolean | distance_flag = CUBIT_FALSE |
||
) |
CubitStatus GeometryModifyTool::create_surface_doubler | ( | DLIList< RefEntity * > | doubler_entity, |
DLIList< RefEntity * > | target_entity, | ||
DLIList< Body * > & | body_list_out, | ||
CubitBoolean | internal_flg = CUBIT_FALSE , |
||
CubitBoolean | extend_flg = CUBIT_TRUE , |
||
CubitPlane * | limit_plane = NULL , |
||
CubitVector | sweep_direction = CubitVector(0,0,0) , |
||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Definition at line 13328 of file GeometryModifyTool.cpp.
{ //need to switch the DLIList<RefEntity> to a DLIList<RefFace> DLIList<RefFace*> doubler_face; DLIList<RefFace*> target_face; CAST_LIST( doubler_entity, doubler_face, RefFace); CAST_LIST( target_entity, target_face, RefFace); bool enable_undo = CubitUndo::get_undo_enabled() && preview == CUBIT_FALSE; if(enable_undo) { CubitUndo::save_state_with_cubit_file(doubler_face); } DLIList <Surface*> doubler_surface; DLIList <Surface*> target_surface; DLIList <Body*> old_body_list; DLIList<RefFace*> tweak_face; DLIList<Surface*> tweak_surface; tweak_face+=doubler_face; tweak_face+=target_face; GeometryModifyEngine* gme_ptr; int ii=0, i=0; gme_ptr = tweak_setup(tweak_face,"doubler",old_body_list,tweak_surface); int z; for(z=0;z<doubler_face.size();z++) { doubler_surface.append(tweak_surface[z]); } for(z=doubler_face.size();z<tweak_face.size();z++) { target_surface.append(tweak_surface[z]); } DLIList<BodySM*> all_kept_bodies; DLIList<BodySM*> body_convert; DLIList<Surface*> copied_doubler_surface; DLIList <BodySM*> tweak_target_bodySM; for(z=0;z<doubler_surface.size();z++) { copied_doubler_surface.append(gme_ptr->make_Surface(doubler_surface[z])); body_convert.append(copied_doubler_surface[z]->bodysm()); } //each workflow is dependent on whether or not a sweep_direction is specified if(sweep_direction == CubitVector(0,0,0)) { DLIList<BodySM*> united_bodies; DLIList<BodySM*> separate_bodies; //this section takes all the doublers, unites them, and then splits them. If only one body //then skip the aforementioned two steps. if(doubler_surface.size()==1) { separate_bodies=body_convert; } else { if(gme_ptr->unite(body_convert,united_bodies) == CUBIT_FAILURE || united_bodies.size()==0 ) { PRINT_ERROR( "Command failed at unite command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } if(gme_ptr->split_body(united_bodies[0],separate_bodies) == CUBIT_FAILURE || separate_bodies.size()==0) { PRINT_ERROR( "Command failed at separate command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } } for(z=0; z<separate_bodies.size();z++) { DLIList<Surface*> body_surface; separate_bodies[z]->surfaces(body_surface); DLIList<CubitVector> doubler_surface_center_points; int d=0; for(d=0;d<body_surface.size();d++) { doubler_surface_center_points.append(body_surface[d]->bounding_box().center()); } CubitVector doubler_normal,doubler_center_pt,doubler_to_target_vector,target_center_pt; double extrude_distance = 0.0; //make sure that the normal of the surface is pointing towards the target surface //the thicken command thickens in the direction of the surface normal, normals are checked using dot product check CubitVector center_pt = body_surface[0]->bounding_box().center(); body_surface[0]->closest_point(center_pt,&doubler_center_pt,&doubler_normal); //adding this for loop because of l bracket doublers may have the first target surface perpendicular to an opposite side doubler surface //resulting in the code erroneously failing double dot=0.0; int mm; for(mm=0; mm<target_surface.size();mm++) { target_surface[mm]->closest_point_trimmed(doubler_center_pt, target_center_pt); doubler_to_target_vector = target_center_pt - doubler_center_pt; dot = doubler_to_target_vector.x()*doubler_normal.x()+doubler_to_target_vector.y()*doubler_normal.y()+doubler_to_target_vector.z()*doubler_normal.z(); if(fabs(dot)>1E-6) { mm=target_surface.size(); } } if(fabs(dot)<1E-6) { PRINT_ERROR( "Doubler and target surface are touching or are perpendicular to each other\n" ); for(ii =0;ii<separate_bodies.size();ii++) { GeometryQueryEngine* gqe = separate_bodies[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(separate_bodies[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } else if(dot < 0) { if(gme_ptr->reverse_body(separate_bodies[z])==CUBIT_FAILURE) { PRINT_ERROR( "Command failed at reverse body command.\n" ); for(ii =0;ii<separate_bodies.size();ii++) { GeometryQueryEngine* gqe = separate_bodies[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(separate_bodies[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } extrude_distance = 0.0001; } else { extrude_distance = 0.0001; } DLIList<BodySM*> thickened_doubler_bodySM; DLIList<BodySM*> current_body; current_body.append(separate_bodies[z]); if(gme_ptr->thicken(current_body,thickened_doubler_bodySM,extrude_distance,CUBIT_FALSE) == CUBIT_FAILURE || thickened_doubler_bodySM.size()==0) { PRINT_ERROR( "Command failed at thicken command, this may be due to using a non-OCC geometry engine\n" ); for(ii =0;ii<separate_bodies.size();ii++) { GeometryQueryEngine* gqe = separate_bodies[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(separate_bodies[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //need to grab the newly created surface opposite the user selected one from the thicken function to carry it through for the tweak target DLIList<Surface*> thicken_surfaces; thickened_doubler_bodySM[0]->surfaces(thicken_surfaces); DLIList <Surface*> post_thicken_doublers; int y=0; for(y=0;y<doubler_surface_center_points.size();y++) { doubler_center_pt = doubler_surface_center_points[y]; int r=0; for(r=0;r<thicken_surfaces.size();r++) { CubitVector test_center_pt = thicken_surfaces[r]->bounding_box().center(); if((test_center_pt-doubler_center_pt).length()<=.000001) { post_thicken_doublers.append(thicken_surfaces[r]); } } } DLIList <LoopSM*> doubler_loopSM_list; DLIList <Curve*> doubler_external_curves; Curve* test_external_curves1 = NULL; Curve* test_external_curves2 = NULL; //need to do this in order to grab all curves, not just external IMPORTANT:THIS HAS TO BE DONE BEFORE THE tweak? COMMAND! for(y=0;y<post_thicken_doublers.size();y++) { post_thicken_doublers[y]->loopsms(doubler_loopSM_list); } for(i=0;i<doubler_loopSM_list.size();i++) { doubler_loopSM_list[i]->curves(doubler_external_curves); } doubler_loopSM_list.clean_out(); tweak_target_bodySM.clean_out(); DLIList <LoopSM*> test_loopSM_list; DLIList <Curve*> thicken_external_curves; DLIList <Surface*> tweak_target_surface = thicken_surfaces; //stepping through the surfaces from the thicken body for(i=0; i < thicken_surfaces.size(); i++) { thicken_surfaces[i]->loopsms(test_loopSM_list); //grabbing the external curves from the current thicken_surface test_loopSM_list[0]->curves(thicken_external_curves); test_loopSM_list.clean_out(); int j=0; for(j=0;j<thicken_external_curves.size();j++) { //step through the first curve test_external_curves1 = thicken_external_curves[j]; int k=0; for(k=0; k<doubler_external_curves.size();k++) { //while stepping through the doubler plate curves, compare them to the test_test_surface curves test_external_curves2 = doubler_external_curves[k]; //if the two are equal, they are touching the doulber and therefore are either the side surfaces or the doubler if(test_external_curves2 == test_external_curves1) { //remove the surface from the tweak_target_surface list tweak_target_surface.remove_all_with_value(thicken_surfaces[i]); break; } } if(test_external_curves2 == test_external_curves1) { break; } } thicken_external_curves.clean_out(); } //pass the found opposite surface into the tweak_target routine if(gme_ptr->tweak_target(tweak_target_surface,target_surface,tweak_target_bodySM,extend_flg,limit_plane) == CUBIT_FAILURE || tweak_target_bodySM.size()==0) { PRINT_ERROR( "Command failed at Tweak_Target routine\n" ); for(ii =0;ii<thickened_doubler_bodySM.size();ii++) { GeometryQueryEngine* gqe = thickened_doubler_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(thickened_doubler_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //fill out a tweak_body_surface list from tweak_target routine DLIList<Surface*> tweak_body_surfaces; tweak_target_bodySM[0]->surfaces(tweak_body_surfaces); DLIList <Curve*> tweak_external_curves; doubler_external_curves.clean_out(); //refilling DLIList's as needed based on internal_flg //if we are not keeping internal surfaces we do not want it's curves in the doubler_external_curves list //otherwise if we are, we do want the curves in the list for the following sections for loop if(internal_flg==CUBIT_FALSE) { int j=0; for(i=0;i<post_thicken_doublers.size();i++) { post_thicken_doublers[i]->loopsms(doubler_loopSM_list); for(j=0;j<doubler_loopSM_list.size();j++) { LoopType loop_type = doubler_loopSM_list[j]->loop_type(); if(loop_type == LOOP_TYPE_EXTERNAL || loop_type == LOOP_TYPE_U_PERIODIC || loop_type == LOOP_TYPE_V_PERIODIC) { doubler_loopSM_list[j]->curves(doubler_external_curves); break; } } doubler_loopSM_list.clean_out(); } } else { for(i=0;i<post_thicken_doublers.size();i++) { post_thicken_doublers[i]->loopsms(doubler_loopSM_list); } for(i=0;i<doubler_loopSM_list.size();i++) { doubler_loopSM_list[i]->curves(doubler_external_curves); } } DLIList <Surface*> surfaces_to_keep; for(i=0;i<tweak_body_surfaces.size();i++) { tweak_body_surfaces[i]->loopsms(test_loopSM_list); if(test_loopSM_list.size()==0) { PRINT_ERROR( "Command failed to find any doubler drop down curves\n" ); for(ii =0;ii<thickened_doubler_bodySM.size();ii++) { GeometryQueryEngine* gqe = thickened_doubler_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(thickened_doubler_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } test_loopSM_list[0]->curves(tweak_external_curves); test_loopSM_list.clean_out(); int j=0; for(j=0;j<tweak_external_curves.size();j++) { test_external_curves1 = tweak_external_curves[j]; int k=0; for(k=0; k<doubler_external_curves.size();k++) { //while stepping through the doubler plate curves, compare them to the test_loop_list test_external_curves2 = doubler_external_curves[k]; if(test_external_curves2 == test_external_curves1) { surfaces_to_keep.append(tweak_body_surfaces[i]); break; } } if(test_external_curves2 == test_external_curves1) { break; } } tweak_external_curves.clean_out(); } if(surfaces_to_keep.size()==0) { PRINT_ERROR( "Failed to find and keep surfaces\n" ); for(ii =0;ii<tweak_target_bodySM.size();ii++) { GeometryQueryEngine* gqe = tweak_target_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(tweak_target_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //do this to remove the copied_doubler_surface since we no longer need the surface anymore int c=0; for(c=0;c<post_thicken_doublers.size();c++) { surfaces_to_keep.remove_all_with_value(post_thicken_doublers[c]); } DLIList <Surface*> surfaces_to_remove = tweak_body_surfaces; surfaces_to_remove -= surfaces_to_keep; DLIList<BodySM*> resulting_bodies; //remove all surfaces in the surfaces_to_remove list if(gme_ptr->tweak_remove(surfaces_to_remove,resulting_bodies,CUBIT_FALSE) == CUBIT_FAILURE || resulting_bodies.size()==0) { PRINT_ERROR( "Command failed at Tweak_Remove routine\n" ); for(ii =0;ii<tweak_target_bodySM.size();ii++) { GeometryQueryEngine* gqe = tweak_target_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(tweak_target_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } all_kept_bodies+=resulting_bodies; } } else { DLIList<BodySM*> swept_bodies; DLIList<BodySM*> swept_doubler_bodySM; //take the copied_doubler_surface and extrude it along the sweep_direction to create a body for(z=0;z<copied_doubler_surface.size();z++) { DLIList<GeometryEntity*> DLIList_copied_doubler_surface; DLIList_copied_doubler_surface.append(copied_doubler_surface[z]); if(gme_ptr->sweep_translational(DLIList_copied_doubler_surface,swept_doubler_bodySM,sweep_direction*0.0001,0.0,0,CUBIT_FALSE,CUBIT_FALSE) == CUBIT_FAILURE || swept_doubler_bodySM.size()==0) { PRINT_ERROR( "Command failed at sweep->extrude command\n" ); for(ii =0;ii<body_convert.size();ii++) { GeometryQueryEngine* gqe = body_convert[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(body_convert[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } swept_bodies+=swept_doubler_bodySM; swept_doubler_bodySM.clean_out(); } DLIList<BodySM*> united_bodies; DLIList<BodySM*> separate_bodies; //if more than one body, unite and split the newly created bodies, if only one body skip this step //as the unite will fail if(swept_bodies.size()==1) { separate_bodies=swept_bodies; } else { if(gme_ptr->unite(swept_bodies,united_bodies) == CUBIT_FAILURE || united_bodies.size()==0 ) { PRINT_ERROR( "Command failed at unite command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } if(gme_ptr->split_body(united_bodies[0],separate_bodies) == CUBIT_FAILURE || separate_bodies.size()==0) { PRINT_ERROR( "Command failed at separate command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } } //create another copy of copied_doubler_surface since copied_doubler_surface is going to be manipulated DLIList<Surface*> temp_copied_doubler_surface=copied_doubler_surface; for(z=0;z<separate_bodies.size();z++) { //need to grab the newly created surface opposite the user selected one from the thicken function to carry it through for the tweak target //this will need to be changed to a for loop to account for multiple thickened bodies if we impliment multiple doubler surfaces DLIList<Surface*> thicken_surfaces; separate_bodies[z]->surfaces(thicken_surfaces); //initializing a lot of variables to be used in the next few steps DLIList<Surface*> master_surface_remove_list; DLIList <Curve*> thicken_external_curves; DLIList<Surface*> tweak_target_surface; DLIList<Surface*> surfaces_to_remove; //using a centerpoint of the surfaces, I want to find out which surface from the recently swept bodies corresponds to the surface of the body closest the target //this has to be done because sweep_translational moves the source surface. Thicken on the otherhand does and doesn't based on number of surfaces being thickened. int y=0; for(y=0;y<temp_copied_doubler_surface.size();y++) { CubitVector doubler_center_pt = temp_copied_doubler_surface[y]->bounding_box().center(); int r=0; for(r=0;r<thicken_surfaces.size();r++) { CubitVector test_center_pt = thicken_surfaces[r]->bounding_box().center(); if((test_center_pt-doubler_center_pt).length()<=.000001) { tweak_target_surface.append(thicken_surfaces[r]); surfaces_to_remove.append(temp_copied_doubler_surface[y]); } } } //remove the manipulated surfaces from the temp_copied_doubler_surface list temp_copied_doubler_surface-=surfaces_to_remove; surfaces_to_remove.clean_out(); //grab all the curves of the doubler DLIList <Curve*> doubler_external_curves; DLIList <LoopSM*> doubler_loopSM_list; for(y=0;y<tweak_target_surface.size();y++) { tweak_target_surface[y]->loopsms(doubler_loopSM_list); } for(i=0;i<doubler_loopSM_list.size();i++) { doubler_loopSM_list[i]->curves(doubler_external_curves); } DLIList <Surface*> doubler_surface_for_this_body = thicken_surfaces; Curve* test_external_curves1 = NULL; Curve* test_external_curves2 = NULL; DLIList <LoopSM*> test_loopSM_list; for(i=0; i < thicken_surfaces.size(); i++) { //step through the thickened bodies surfaces thicken_surfaces[i]->loopsms(test_loopSM_list); //grabbing the external curve loop from the face and making it a DLIList <RefEdge*> test_loopSM_list[0]->curves(thicken_external_curves); int j=0; for(j=0;j<thicken_external_curves.size();j++) { //step through the loop list test_external_curves1 = thicken_external_curves[j]; int k=0; for(k=0; k<doubler_external_curves.size();k++) { //while stepping through the doubler plate curves, compare them to the test_loop_list test_external_curves2 = doubler_external_curves[k]; if(test_external_curves2 == test_external_curves1) { doubler_surface_for_this_body.remove_all_with_value(thicken_surfaces[i]); break; } } if(test_external_curves2 == test_external_curves1) { break; } } thicken_external_curves.clean_out(); thicken_external_curves.reset(); test_loopSM_list.clean_out(); } //DLIList <BodySM*> tweak_target_bodySM tweak_target_bodySM.clean_out(); if(gme_ptr->tweak_target(tweak_target_surface,target_surface,tweak_target_bodySM,extend_flg,limit_plane) == CUBIT_FAILURE || tweak_target_bodySM.size()==0) { PRINT_ERROR( "Command failed at Tweak_Target routine\n" ); for(ii =0;ii<body_convert.size();ii++) { GeometryQueryEngine* gqe = body_convert[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(body_convert[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //make note of the doubler_surface and add it to the delete list master_surface_remove_list+=doubler_surface_for_this_body; //clean out these DLIList's as they will be used later on doubler_loopSM_list.clean_out(); doubler_external_curves.clean_out(); //refilling DLIList's as needed based on internal_flg //basically if surfaces share a curve, that surface will be kept so if you don't want the internal surfaces //create the list without the internal curves and they'll be removed if(internal_flg==CUBIT_FALSE) { int j=0; for(i=0;i<doubler_surface_for_this_body.size();i++) { doubler_surface_for_this_body[i]->loopsms(doubler_loopSM_list); for(j=0;j<doubler_loopSM_list.size();j++) { LoopType loop_type = doubler_loopSM_list[j]->loop_type(); if(loop_type == LOOP_TYPE_EXTERNAL || loop_type == LOOP_TYPE_U_PERIODIC || loop_type == LOOP_TYPE_V_PERIODIC) { doubler_loopSM_list[j]->curves(doubler_external_curves); break; } } doubler_loopSM_list.clean_out(); } } else { for(i=0;i<doubler_surface_for_this_body.size();i++) { doubler_surface_for_this_body[i]->loopsms(doubler_loopSM_list); } for(i=0;i<doubler_loopSM_list.size();i++) { doubler_loopSM_list[i]->curves(doubler_external_curves); } } //recreate the thicken_surfaces list based now on the bodies after the tweak_target command thicken_surfaces.clean_out(); tweak_target_bodySM[0]->surfaces(thicken_surfaces); DLIList <Surface*> surfaces_to_keep; surfaces_to_remove = thicken_surfaces; DLIList <Curve*> tweak_external_curves; for(i=0;i<thicken_surfaces.size();i++) { thicken_surfaces[i]->loopsms(test_loopSM_list); //grabs the external curves from face test_loopSM_list[0]->curves(tweak_external_curves); int j=0; for(j=0;j<tweak_external_curves.size();j++) { //step through the loop list test_external_curves1 = tweak_external_curves[j]; int k=0; for(k=0; k<doubler_external_curves.size();k++) { //while stepping through the doubler plate curves, compare them to the test_loop_list test_external_curves2 = doubler_external_curves[k]; if(test_external_curves2 == test_external_curves1) { surfaces_to_keep.append(thicken_surfaces[i]); break; } } if(test_external_curves2 == test_external_curves1) { break; } } test_loopSM_list.clean_out(); tweak_external_curves.clean_out(); } if(surfaces_to_keep.size()==0) { PRINT_ERROR( "Failed to find and keep tweak_target surfaces\n" ); for(ii =0;ii<tweak_target_bodySM.size();ii++) { GeometryQueryEngine* gqe = tweak_target_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(tweak_target_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //subtract surfaces surfaces_to_remove -= surfaces_to_keep; master_surface_remove_list+=surfaces_to_remove; DLIList<BodySM*> resulting_bodies; if(gme_ptr->tweak_remove(master_surface_remove_list,resulting_bodies,CUBIT_FALSE) == CUBIT_FAILURE || resulting_bodies.size()==0) { PRINT_ERROR( "Command failed at Tweak_Remove routine\n" ); for(ii =0;ii<tweak_target_bodySM.size();ii++) { GeometryQueryEngine* gqe = tweak_target_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(tweak_target_bodySM[ii]); } if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //all_kept_bodies is a list of bodies that will eventually be passed into finish_sm_op at the end all_kept_bodies+=resulting_bodies; } } if(preview==CUBIT_FALSE) { DLIList<BodySM*> bodies_to_unite; //check to see if their is only one body. If only one body skip over the unite and split because //the unite command will fail (there is a check at the beginning to return cubit_failure) //append the original doubler surfaces to the resulting body list for(i=0;i<doubler_surface.size();i++) { all_kept_bodies.insert_first(doubler_surface[i]->bodysm()); } if(all_kept_bodies.size()!=1) { if(gme_ptr->unite(all_kept_bodies,bodies_to_unite) == CUBIT_FAILURE || bodies_to_unite.size()==0 ) { PRINT_ERROR( "Command failed at unite command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } all_kept_bodies.clean_out(); if(gme_ptr->split_body(bodies_to_unite[0],all_kept_bodies) == CUBIT_FAILURE || all_kept_bodies.size()==0) { PRINT_ERROR( "Command failed at separate command\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } } else { PRINT_WARNING( "Command may have failed at finding doubler surface(s) and appending them to the drop-down surfaces\n" ); if(enable_undo) CubitUndo::remove_last_undo(); return CUBIT_FAILURE; } //update DAG CubitStatus stat; stat = finish_sm_op( old_body_list, all_kept_bodies ,body_list_out ); if (CUBIT_SUCCESS != stat) { PRINT_ERROR("GeometryModifyTool::finish_sm_op failed.\n"); return stat; } if(enable_undo) CubitUndo::note_result_bodies(body_list_out); return CUBIT_SUCCESS; } else { DLIList<Curve*> kept_curves; for(i =0;i<all_kept_bodies.size();i++) { all_kept_bodies[i]->curves(kept_curves); } GfxPreview::clear(); for(i=0; i<kept_curves.size();i++) { CubitStatus result; GMem g_mem; // get the graphics result = kept_curves[i]->get_geometry_query_engine()-> get_graphics( kept_curves[i], &g_mem ); if (result==CUBIT_FAILURE || g_mem.pointListCount == 0) { PRINT_WARNING("Unable to preview a curve\n" );; double len = kept_curves[i]-> length_from_u(kept_curves[i]->start_param(),kept_curves[i]->end_param()); PRINT_WARNING("Curve len: %f\n",len); } // Draw the polyline GfxPreview::draw_polyline( g_mem.point_list(), g_mem.pointListCount, CUBIT_BLUE_INDEX ); } GfxPreview::flush(); for(ii =0;ii<tweak_target_bodySM.size();ii++) { GeometryQueryEngine* gqe = tweak_target_bodySM[ii]->get_geometry_query_engine(); gqe->delete_solid_model_entities(tweak_target_bodySM[ii]); } if(enable_undo) CubitUndo::note_result_bodies(body_list_out); return CUBIT_SUCCESS; } }
CubitStatus GeometryModifyTool::create_weld_surface | ( | CubitVector & | root, |
RefFace * | ref_face1, | ||
double | leg1, | ||
RefFace * | ref_face2, | ||
double | leg2, | ||
Body *& | new_body | ||
) |
Creates a simple triangular weld surface.
Definition at line 18258 of file GeometryModifyTool.cpp.
{ GeometryModifyEngine* GMEPtr; DLIList<RefFace*> ref_faces; ref_faces.append(ref_face1); ref_faces.append(ref_face2); DLIList<Surface*> surfaces; GMEPtr = common_modify_engine(ref_faces, surfaces); if (!GMEPtr) { PRINT_ERROR("Loft surfaces on volumes containing surfaces from different\n" " geometry engines is not allowed.\n"); return CUBIT_FAILURE; } if (CubitUndo::get_undo_enabled()) CubitUndo::save_state(); surfaces.reset(); BodySM* new_body_sm = 0; CubitStatus result = GMEPtr->create_weld_surface( root, surfaces.get_and_step(), leg1, surfaces.get_and_step(), leg2, new_body_sm ); if(result && new_body_sm) { new_body = GeometryQueryTool::instance()->make_Body(new_body_sm); if (new_body) { if (CubitUndo::get_undo_enabled()) CubitUndo::note_result_body(new_body); } else { if (CubitUndo::get_undo_enabled()) CubitUndo::remove_last_undo(); } } return result; }
Body * GeometryModifyTool::cylinder | ( | double | hi, |
double | r1, | ||
double | r2, | ||
double | r3 | ||
) |
Creates a clyinder.
Creates an frustum and assigns it to a Body $ {hi} input height $ {r1} input radius in x-direction at base $ {r2} input radius in y-direction at base $ {r3} input radius in x-direction at top Returns the new Body or NULL
Definition at line 653 of file GeometryModifyTool.cpp.
{ if (0 == gmeList.size()) { PRINT_WARNING("No active geometry engine.\n"); return NULL; } // First make sure that the input values make sense if ( hi <= GEOMETRY_RESABS || r1 <= GEOMETRY_RESABS || r2 <= GEOMETRY_RESABS || r3 < 0.0 ) { PRINT_ERROR("In GeometryModifyTool::cylinder\n" " Cannot make a frustum of a cone with height = %f," " lower x-direction radius = %f," " lower y-direction radius = %f, and " "top radius = %f\n" " All dimensions must be > 0.0\n", hi, r1, r2, r3); return NULL; } if( CubitUndo::get_undo_enabled() ) CubitUndo::save_state(); // Create a Body that represents the prism BodySM* bodyPtr = gmeList.get()->cylinder( hi, r1, r2, r3); Body *new_body = NULL; if (bodyPtr == NULL) { PRINT_ERROR("In GeometryModifyTool::cylinder\n" " Problems building a volume from the conical frustum.\n"); } else new_body = GeometryQueryTool::instance()->make_Body(bodyPtr); if( CubitUndo::get_undo_enabled() ) { if( new_body ) CubitUndo::note_result_body( new_body ); else CubitUndo::remove_last_undo(); } return new_body; }
void GeometryModifyTool::delete_instance | ( | ) | [static] |
Definition at line 210 of file GeometryModifyTool.cpp.
CubitStatus GeometryModifyTool::discover_topology | ( | RefFace * | ref_face_ptr, |
CubitVector & | pos, | ||
double & | step_size, | ||
int | num_subdivisions | ||
) |
Beta function.
Definition at line 20629 of file GeometryModifyTool.cpp.
{ CubitStatus ret = CUBIT_SUCCESS; CubitVector point_on_surf; surf->get_surface_ptr()->closest_point_trimmed(pos, point_on_surf); RefVolume *v = surf->ref_volume(); CubitVector norm = surf->normal_at(point_on_surf, v); CubitVector march_dir = norm * CubitVector(1,0,0); if(march_dir.length() < .001) { march_dir = norm * CubitVector(0,1,0); if(march_dir.length() < .001) { march_dir = norm * CubitVector(0,0,1); if(march_dir.length() < .001) { PRINT_ERROR("Couldn't find a good march direction.\n"); ret = CUBIT_FAILURE; } } } if(ret == CUBIT_SUCCESS) { int new_approach = 0; if(new_approach) { // Get initial 4 directions. march_dir.normalize(); DLIList<CubitVector> march_directions; CubitVector v1 = march_dir; CubitVector v3 = -march_dir; CubitVector v2 = norm*march_dir; march_directions.append(v1); march_directions.append(v2); march_directions.append(v3); // Now subdivide directions further if requested. for(int i=0; i<num_subdivisions; ++i) { DLIList<CubitVector> tmp_list; int list_size = march_directions.size(); for(int j=0; j<list_size-1; j++) { CubitVector dir1 = march_directions[j]; CubitVector dir2 = march_directions[(j+1)%list_size]; CubitVector mid = dir1 + dir2; mid.normalize(); tmp_list.append(dir1); tmp_list.append(mid); } tmp_list.append(march_directions[list_size-1]); march_directions = tmp_list; } DLIList<DLIList<CubitVector> > horizontal_points, vertical_points; DLIList<RefFace*> horiz_ending_faces, vert_ending_faces; for(int i=0; i<march_directions.size()-1; i++) { DLIList<CubitVector> new_list; horizontal_points.append(new_list); vertical_points.append(new_list); march_using_planes(point_on_surf, surf, march_directions[i], step_size, horizontal_points[i], vertical_points[i]); } } else { // Get initial 4 directions. march_dir.normalize(); DLIList<CubitVector> march_directions; CubitVector v1 = march_dir; CubitVector v3 = -march_dir; CubitVector v2 = norm*march_dir; CubitVector v4 = -v2; march_directions.append(v1); march_directions.append(v2); march_directions.append(v3); march_directions.append(v4); // Now subdivide directions further if requested. for(int i=0; i<num_subdivisions; ++i) { DLIList<CubitVector> tmp_list; int list_size = march_directions.size(); for(int j=0; j<list_size; j++) { CubitVector dir1 = march_directions[j]; CubitVector dir2 = march_directions[(j+1)%list_size]; CubitVector mid = dir1 + dir2; mid.normalize(); tmp_list.append(dir1); tmp_list.append(mid); } march_directions = tmp_list; } DLIList<DLIList<CubitVector> > horizontal_points, vertical_points; DLIList<RefFace*> horiz_ending_faces, vert_ending_faces; for(int i=0; i<march_directions.size(); i++) { DLIList<CubitVector> new_list; new_list.append(point_on_surf); horizontal_points.append(new_list); march_path_to_discover_horizontal(point_on_surf, norm, surf, march_directions[i], step_size, horizontal_points[i], horiz_ending_faces); } CubitVector new_dir = -norm; for(int i=0; i<march_directions.size(); i++) { CubitVector start_pos = horizontal_points[i].last_item(); DLIList<CubitVector> new_list; new_list.append(start_pos); vertical_points.append(new_list); march_path_to_discover_vertical(start_pos, norm, horiz_ending_faces[i], new_dir, step_size, vertical_points[i], vert_ending_faces); // GfxDebug::draw_point(vertical_points[i].last_item(), CUBIT_GREEN_INDEX); // GfxDebug::flush(); } // Draw lines traced out by marching directions for(int i=0; i<horizontal_points.size(); i++) { int size1 = horizontal_points[i].size(); for(int j=0; j<size1-1; j++) { GfxDebug::draw_line(horizontal_points[i][j], horizontal_points[i][j+1], CUBIT_WHITE_INDEX); } } for(int i=0; i<vertical_points.size(); i++) { int size1 = vertical_points[i].size(); for(int j=0; j<size1-1; j++) { GfxDebug::draw_line(vertical_points[i][j], vertical_points[i][j+1], CUBIT_YELLOW_INDEX); } } // Draw new topology int size1 = horizontal_points.size(); for(int i=0; i<size1; i++) { GfxDebug::draw_line(horizontal_points[i].last_item(), horizontal_points[(i+1)%size1].last_item(), CUBIT_RED_INDEX); } size1 = vertical_points.size(); for(int i=0; i<size1; i++) { GfxDebug::draw_line(vertical_points[i].last_item(), vertical_points[(i+1)%size1].last_item(), CUBIT_RED_INDEX); } GfxDebug::flush(); } } return ret; }
void GeometryModifyTool::do_attribute_cleanup | ( | void | ) | [private] |
Definition at line 3412 of file GeometryModifyTool.cpp.
{ CGMApp::instance()->restore_previous_attribute_states(); }
void GeometryModifyTool::do_attribute_setup | ( | void | ) | [private] |
Definition at line 3365 of file GeometryModifyTool.cpp.
{ //save attribute settings CGMApp::instance()->save_current_attribute_states(); //Turn off all attributes CubitAttribManager *attrib_manager = CGMApp::instance()->attrib_manager(); attrib_manager->set_all_auto_update_flags( CUBIT_FALSE ); attrib_manager->set_all_auto_actuate_flags( CUBIT_FALSE ); attrib_manager->set_all_auto_write_flags( CUBIT_FALSE ); attrib_manager->set_all_auto_read_flags( CUBIT_FALSE ); CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_ENTITY_NAME, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_ENTITY_NAME, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_ENTITY_NAME, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_ENTITY_NAME, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_MESH_OUTPUT_GROUP, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_MESH_OUTPUT_GROUP, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_MESH_OUTPUT_GROUP, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_MESH_OUTPUT_GROUP, CUBIT_TRUE); // enable update, actuate, write, read for composite attributes CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_COMPOSITE_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_COMPOSITE_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_COMPOSITE_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_COMPOSITE_VG, CUBIT_TRUE); // enable update, actuate, write, read for partition attributes CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_PARTITION_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_PARTITION_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_PARTITION_VG, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_PARTITION_VG, CUBIT_TRUE); // enable update, actuate, write, read for entity ids // We will use these ID atts to make sure the ref entities associated with unmodified // virtual bridges will maintain the same ids after real operations. CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_ENTITY_ID, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_ENTITY_ID, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_ENTITY_ID, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_ENTITY_ID, CUBIT_TRUE); // enable metadata attributes CGMApp::instance()->attrib_manager()->set_auto_update_flag(CA_ASSEMBLY_DATA, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_actuate_flag(CA_ASSEMBLY_DATA, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_write_flag(CA_ASSEMBLY_DATA, CUBIT_TRUE); CGMApp::instance()->attrib_manager()->set_auto_read_flag(CA_ASSEMBLY_DATA, CUBIT_TRUE); }
CubitStatus GeometryModifyTool::find_best_curves_to_merge | ( | DLIList< RefEdge * > *& | curves_from_curve1, |
DLIList< RefEdge * > *& | curves_from_curve2, | ||
RefEdge *& | curve1, | ||
RefEdge *& | curve2 | ||
) | [private] |
Definition at line 19119 of file GeometryModifyTool.cpp.
{ /* for(int i=curves_from_curve1.size(); i>0; i--) { if found better curve than curve1 set curve1 to be this curve } for(int i=curves_from_curve2.size(); i>0; i--) { if found better curve than curve2 set curve2 to be this curve } */ return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::find_overlap_region | ( | RefEdge * | c1, |
RefEdge * | c2, | ||
RefVertex * | v1, | ||
RefVertex * | v2, | ||
bool | forward_c1, | ||
bool | forward_c2, | ||
bool & | full_c1, | ||
bool & | full_c2, | ||
double & | c1_stop_param, | ||
double & | c2_stop_param, | ||
double | divergence_angle | ||
) | [private] |
Definition at line 19374 of file GeometryModifyTool.cpp.
{ CubitStatus status = CUBIT_SUCCESS; double start_t, end_t, dt, cur_t; int num_segments = 20; double reverse_multiplier; double divergence_tol = cos(divergence_angle*CUBIT_PI/180.0); int i; if(forward_c1 != forward_c2) reverse_multiplier = -1.0; else reverse_multiplier = 1.0; // Start from the projection of v2 onto c1. CubitVector tmp_pos; c1->closest_point_trimmed(v2->coordinates(), tmp_pos); start_t = c1->u_from_position(tmp_pos); if(forward_c1) { end_t = c1->end_param(); dt = (end_t-start_t)/(double)num_segments; cur_t = start_t + dt; } else { end_t = c1->start_param(); dt = (end_t-start_t)/(double)num_segments; cur_t = start_t + dt; } // Check all of the interior points to see if the tangents // of the two curves are within tolerance. bool went_past_end_of_c2 = false; bool went_out_of_angle_tolerance = false; for(i=num_segments; i>0; i--) // for(i=num_segments-1; i>0; i--) { if(i==1) { cur_t = end_t; } // Evaluate curve 1. CubitVector vec1, vec2, tangent1, tangent2; c1->position_from_u(cur_t, vec1); c1->tangent(vec1, tangent1); tangent1.normalize(); // Project the point to curve 2 and get the tangent. c2->closest_point_trimmed(vec1, vec2); c2->tangent(vec2, tangent2); tangent2.normalize(); if(((tangent1 % tangent2) * reverse_multiplier) > divergence_tol) { CubitVector check_vec = vec2-vec1; double dot_val = 0.0; if(check_vec.length() > 1e-6) { check_vec.normalize(); dot_val = check_vec % tangent2; } if(dot_val > .001 || dot_val < -.001) { went_past_end_of_c2 = true; } else { // If we made it to the end of curve 1 check to see // if the end of curve 2 is within some tolerance of // the endpoint of curve 1 and if so set the // full_c2 flag to true. if(i==1) { RefVertex *c1_end, *c2_end; if(forward_c1) c1_end = c1->end_vertex(); else c1_end = c1->start_vertex(); if(forward_c2) c2_end = c2->end_vertex(); else c2_end = c2->start_vertex(); if(c1_end == c2_end) // verts are already merged full_c2 = true; else { CubitVector c2_end_pos; if(forward_c2) c2_end_pos = c2->end_coordinates(); else c2_end_pos = c2->start_coordinates(); double dist_sq_1 = (vec1-vec2).length_squared(); double dist_sq_2 = (vec1-c2_end_pos).length_squared(); if(dist_sq_2 < 2.25*dist_sq_1) full_c2 = true; } } } } else { went_out_of_angle_tolerance = true; } if(went_past_end_of_c2) { i=0; full_c2 = true; c1_stop_param = cur_t; // calculate split point on curve 1 } else if(went_out_of_angle_tolerance) { if(i==num_segments) status = CUBIT_FAILURE; i=0; c1_stop_param = cur_t; c2_stop_param = c2->u_from_position(vec2); } cur_t += dt; } if(i==0) { full_c1 = true; } return status; }
CubitVector GeometryModifyTool::FindExtendedEndPt | ( | double | outer_rad, |
double | inner_rad, | ||
CubitVector | inner_AxisPt, | ||
CubitVector | Axis, | ||
double | Height | ||
) | [private] |
Definition at line 21505 of file GeometryModifyTool.cpp.
{ CubitVector Extended_End_Pt; double Diff = (outer_rad - inner_rad); Diff /= Height; double dAngle = atan ( Diff ) ; Axis.normalize(); double dTan = tan( dAngle ); double dExtendvalue = inner_rad / dTan; CubitVector ExtendedPt; ExtendedPt.x( ( Axis.x() * dExtendvalue ) + inner_AxisPt.x() ); ExtendedPt.y( ( Axis.y() * dExtendvalue ) + inner_AxisPt.y() ); ExtendedPt.z( ( Axis.z() * dExtendvalue ) + inner_AxisPt.z() ); return ExtendedPt; }
void GeometryModifyTool::FindExtendedPoints | ( | CubitVector | AxisPt1, |
CubitVector | AxisPt2, | ||
double | outer_radius, | ||
double | inner_radius, | ||
CubitVector | axis, | ||
double | Height, | ||
CubitBox | bounding_box, | ||
double | dTanAngle, | ||
CubitVector & | start, | ||
CubitVector & | end, | ||
double & | dExtended_OuterRadius, | ||
double & | dExtended_InnerRadius | ||
) | [private] |
Definition at line 21567 of file GeometryModifyTool.cpp.
{ CubitVector endpt ; if( outer_radius > inner_radius ) { endpt = FindExtendedEndPt( outer_radius , inner_radius , AxisPt2 , axis, Height ); Height = sqrt( (endpt.x() - AxisPt1.x()) * (endpt.x() - AxisPt1.x())+ (endpt.y() - AxisPt1.y()) * (endpt.y() - AxisPt1.y())+ (endpt.z() - AxisPt1.z()) * (endpt.z() - AxisPt1.z()) ); AxisPt2.x( endpt.x() ); AxisPt2.y( endpt.y() ); AxisPt2.z( endpt.z() ); end.x( endpt.x() ); end.y( endpt.y() ); end.z( endpt.z() ); dExtended_InnerRadius = 0; } else { // reverse the axis. axis.x( -axis.x()); axis.y( -axis.y()); axis.z( -axis.z()); endpt = FindExtendedEndPt( inner_radius , outer_radius , AxisPt1 , axis, Height ); Height = sqrt( (endpt.x() - AxisPt2.x()) * (endpt.x() - AxisPt2.x())+ (endpt.y() - AxisPt2.y()) * (endpt.y() - AxisPt2.y())+ (endpt.z() - AxisPt2.z()) * (endpt.z() - AxisPt2.z()) ); AxisPt1.x( endpt.x() ); AxisPt1.y( endpt.y() ); AxisPt1.z( endpt.z() ); start.x( endpt.x() ); start.y( endpt.y() ); start.z( endpt.z() ); // reset the axis. axis.x( -axis.x()); axis.y( -axis.y()); axis.z( -axis.z()); dExtended_OuterRadius = 0; } //*****************************************// // Now find the extension of the bigger end. //*****************************************// if( outer_radius > inner_radius ) { // reverse the axis. axis.x( -axis.x()); axis.y( -axis.y()); axis.z( -axis.z()); endpt = FindExtendedStartPt( bounding_box , outer_radius , inner_radius , AxisPt1 , axis, Height , dTanAngle , dExtended_OuterRadius ); Height = sqrt( (endpt.x() - AxisPt2.x()) * (endpt.x() - AxisPt2.x())+ (endpt.y() - AxisPt2.y()) * (endpt.y() - AxisPt2.y())+ (endpt.z() - AxisPt2.z()) * (endpt.z() - AxisPt2.z()) ); AxisPt1.x( endpt.x() ); AxisPt1.y( endpt.y() ); AxisPt1.z( endpt.z() ); start.x( endpt.x() ); start.y( endpt.y() ); start.z( endpt.z() ); // reverse the axis. axis.x( -axis.x()); axis.y( -axis.y()); axis.z( -axis.z()); } else { endpt = FindExtendedStartPt( bounding_box , inner_radius , outer_radius , AxisPt2 , axis, Height , dTanAngle , dExtended_InnerRadius ); Height = sqrt( (endpt.x() - AxisPt1.x()) * (endpt.x() - AxisPt1.x())+ (endpt.y() - AxisPt1.y()) * (endpt.y() - AxisPt1.y())+ (endpt.z() - AxisPt1.z()) * (endpt.z() - AxisPt1.z()) ); AxisPt2.x( endpt.x() ); AxisPt2.y( endpt.y() ); AxisPt2.z( endpt.z() ); end.x( endpt.x() ); end.y( endpt.y() ); end.z( endpt.z() ); } }
CubitVector GeometryModifyTool::FindExtendedStartPt | ( | CubitBox | box, |
double | outer_rad, | ||
double | inner_rad, | ||
CubitVector | inner_AxisPt, | ||
CubitVector | Axis, | ||
double & | Height, | ||
double | dTanAngle, | ||
double & | dExtendedadius | ||
) | [private] |
2
Definition at line 21526 of file GeometryModifyTool.cpp.
{ CubitVector Extended_Start_Pt; // Find the Difference between the Max and thre min values in all 3 directions. // Incase the point is within the box limits, then add the difference values // in all 3 directions , witht he " Axis " as the direction vector and extend the point. // After that find the Radius of this bigger end. CubitVector DiffVec; Axis.normalize(); DiffVec.x( fabs( Box.max_x() - Box.min_x() )); DiffVec.y( fabs( Box.max_y() - Box.min_y() )); DiffVec.z( fabs( Box.max_z() - Box.min_z() )); // Extend the start Pt Extended_Start_Pt.x( AxisPt.x() + ( Axis.x() * DiffVec.x() ) ); Extended_Start_Pt.y( AxisPt.y() + ( Axis.y() * DiffVec.y() ) ); Extended_Start_Pt.z( AxisPt.z() + ( Axis.z() * DiffVec.z() ) ); // Find the length dLength = sqrt( (( AxisPt.x() - Extended_Start_Pt.x()) * (AxisPt.x() - Extended_Start_Pt.x()) ) + (( AxisPt.y() - Extended_Start_Pt.y()) * (AxisPt.y() - Extended_Start_Pt.y()) ) + (( AxisPt.z() - Extended_Start_Pt.z()) * (AxisPt.z() - Extended_Start_Pt.z()) ) ); // Find the Extended Radius dExtendedadius = outer_rad + ( tan( dTanAngle ) * dLength ) ; return Extended_Start_Pt; }
CubitStatus GeometryModifyTool::finish_bc_webcut | ( | ) | [private] |
CubitStatus GeometryModifyTool::finish_copy | ( | TopologyBridge *& | new_bridge, |
TopologyBridge * | old_bridge | ||
) | [static] |
Definition at line 1245 of file GeometryModifyTool.cpp.
{ //Remove attributes on underlying entities of virtual geometry //entities which do not have corresponding RefEntities. DLIList<TopologyBridge*> bridge_list; bridge_list.append( old_bridge ); GeometryQueryTool::instance()->ige_remove_attributes( bridge_list ); //Remove attributes on original entity and children DLIList<RefEntity*> child_list; RefEntity *ref_ent = CAST_TO( old_bridge->topology_entity(), RefEntity ); ref_ent->get_all_child_ref_entities( child_list ); //child_list.append( ref_ent ); CubitAttribUser::clear_all_simple_attrib( child_list ); child_list.clean_out(); child_list.append( ref_ent ); CubitAttribUser::clear_all_simple_attrib( child_list ); //Restore virtual //Could create virtual geometry here so the Topology Bridge can change bridge_list.clean_out(); bridge_list.append( new_bridge ); TopologyBridge *tmp_bridge_before = new_bridge; GeometryQueryTool::instance()->ige_import_geom( bridge_list ); assert( bridge_list.size() == 1 ); if( tmp_bridge_before != bridge_list.get() ) new_bridge = bridge_list.get(); //make the RefEntities Curve *curve = NULL; Surface *surface = NULL; Lump *lump = NULL; BodySM *body = NULL; RefEntity *new_ref_ent = NULL; if( (curve = CAST_TO( new_bridge, Curve ) ) != NULL ) new_ref_ent = GeometryQueryTool::instance()->make_RefEdge( curve ); else if( (surface = CAST_TO( new_bridge, Surface) ) != NULL ) new_ref_ent = GeometryQueryTool::instance()->make_RefFace( surface ); else if( (lump = CAST_TO( new_bridge, Lump) ) != NULL ) new_ref_ent = GeometryQueryTool::instance()->make_Body( lump->bodysm() ); else if( (body = CAST_TO( new_bridge, BodySM) ) != NULL ) new_ref_ent = GeometryQueryTool::instance()->make_Body( body ); //actuate the attributes on everything child_list.clean_out(); new_ref_ent->get_all_child_ref_entities( child_list ); child_list.append( new_ref_ent ); GeometryQueryTool::import_actuate( child_list ); //Remove attributes on new entity and children child_list.clean_out(); new_ref_ent->get_all_child_ref_entities( child_list ); CubitAttribUser::clear_all_simple_attrib( child_list ); child_list.clean_out(); child_list.append( new_ref_ent ); CubitAttribUser::clear_all_simple_attrib( child_list ); CGMApp::instance()->restore_previous_attribute_states(); return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::finish_sm_op | ( | DLIList< Body * > & | input_bodies, |
DLIList< BodySM * > & | new_bodies, | ||
DLIList< Body * > & | result_bodies, | ||
bool | print_info = true |
||
) | const |
Internal use only.
Definition at line 2577 of file GeometryModifyTool.cpp.
{ int i; GeometryQueryTool* gqt = GeometryQueryTool::instance(); DLIList<int> updated_ids, created_ids, destroyed_ids; DLIList<int> updated_vol_ids, created_vol_ids, destroyed_vol_ids; // traverse the body object and remove any meshes from modified objects int b; for (b = 0; b < input_bodies.size(); b++) { Body* body = input_bodies.get_and_step(); AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOPOLOGY_ENTITY_MODIFIED, body)); } // Remove dead bodies input_bodies.reset(); for (i = input_bodies.size(); i--;) { Body* body = input_bodies.step_and_get(); BodySM* bodysm = body->get_body_sm_ptr(); if (!bodysm) { // If the body was destroyed, update the list destroyed_ids.append( body->id() ); DLIList<RefVolume*> temp_vols; body->ref_volumes( temp_vols ); for( int nv = temp_vols.size(); nv > 0; nv-- ) { if( !temp_vols.get()->get_lump_ptr() ) destroyed_vol_ids.append( temp_vols.get_and_step()->id() ); } input_bodies.change_to(0); gqt->destroy_dead_entity(body); } else { remove_dead_entity_names( body ); } } gqt->cleanout_deactivated_geometry(); // Create new bodies new_bodies.last(); for (i = new_bodies.size(); i--; ) { BodySM* bodysm = new_bodies.step_and_get(); bool newbody = bodysm->owner() == 0; Body* body = gqt->make_Body(bodysm); result_bodies.append(body); if (newbody) { created_ids.append(body->id()); DLIList<RefVolume*> temp_vols; body->ref_volumes( temp_vols ); for( int nv = temp_vols.size(); nv > 0; nv-- ) { created_vol_ids.append( temp_vols.get_and_step()->id() ); } } else { updated_ids.append(body->id()); DLIList<RefVolume*> temp_vols; body->ref_volumes( temp_vols ); for( int nv = temp_vols.size(); nv > 0; nv-- ) { updated_vol_ids.append( temp_vols.get_and_step()->id() ); } } } gqt->cleanout_deactivated_geometry(); if (print_info) { if( DEBUG_FLAG( 153 ) ) { if (created_ids.size()) CubitUtil::list_entity_ids( "Created body(s): ", created_ids ); if (updated_ids.size()) CubitUtil::list_entity_ids( "Updated body(s): ", updated_ids ); if (destroyed_ids.size()) CubitUtil::list_entity_ids( "Destroyed body(s): ", destroyed_ids ); } if (created_vol_ids.size()) CubitUtil::list_entity_ids( "Created volume(s): ", created_vol_ids ); if (updated_vol_ids.size()) CubitUtil::list_entity_ids( "Updated volume(s): ", updated_vol_ids ); if (destroyed_vol_ids.size()) CubitUtil::list_entity_ids( "Destroyed volume(s): ", destroyed_vol_ids ); } return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::finish_webcut | ( | DLIList< Body * > & | input_bodies, |
DLIList< BodySM * > & | webcut_results, | ||
CubitBoolean | merge, | ||
CubitStatus | webcut_status, | ||
DLIList< Body * > & | new_bodies, | ||
DLIList< int > * | merged_surface_ids = NULL , |
||
DLIList< int > * | merged_curve_ids = NULL , |
||
CubitBoolean | print_info = CUBIT_TRUE |
||
) | const [private] |
Definition at line 2537 of file GeometryModifyTool.cpp.
{ if (!finish_sm_op(webcut_body_list, result_body_sms, result_list,(bool)print_info)) status = CUBIT_FAILURE; DLIList<Body*> temp_result_list; if (status) { status = separate_body_after_webcut( result_list, temp_result_list); result_list = temp_result_list; } if( merged_surface_ids && merged_curve_ids ) fixup_merged_entities( *merged_surface_ids, *merged_curve_ids ); if (merge && status) { DLIList<Body*> temp_results(result_list); status = MergeTool::instance()->merge_bodies( temp_results ); } return status; }
void GeometryModifyTool::fixup_merged_entities | ( | DLIList< int > & | merged_surface_ids, |
DLIList< int > & | merged_curve_ids | ||
) | const [private] |
Definition at line 20000 of file GeometryModifyTool.cpp.
{ //use ids to find surviving merged entities DLIList<RefFace*> ref_face_list; DLIList<RefEdge*> ref_edge_list; int i; //see what merged survived operation for( i=merged_surface_ids.size(); i--; ) { int face_id = merged_surface_ids.get_and_step(); RefFace *surviving_merged_face = RefEntityFactory::instance()->get_ref_face( face_id ); if( surviving_merged_face ) ref_face_list.append( surviving_merged_face ); } //see what merged survived operation for( i=merged_curve_ids.size(); i--; ) { int edge_id = merged_curve_ids.get_and_step(); RefEdge *surviving_merged_edge = RefEntityFactory::instance()->get_ref_edge( edge_id ); if( surviving_merged_edge ) ref_edge_list.append( surviving_merged_edge ); } //fix up merged faces -- some might need to be reversed for(i=ref_face_list.size(); i--; ) { RefFace *merged_face = ref_face_list.get_and_step(); BasicTopologyEntity *bte = static_cast<BasicTopologyEntity*>(merged_face); //get the first bridge of the entity DLIList<TopologyBridge*> face_bridge_list; bte->bridge_manager()->get_bridge_list( face_bridge_list ); //if there are 2 bridges in the list, it's still merged...do nothing if( face_bridge_list.size() > 1 ) continue; //get the center of the RefFace CubitVector center = merged_face->center_point(); //get the normal according to the RefFace CubitVector ref_face_normal = merged_face->normal_at( center ); //get the normal at the center from the underlying Surface Surface *surface_ptr = CAST_TO( face_bridge_list.get(), Surface ); CubitVector surface_normal; surface_ptr->closest_point( center, NULL, &surface_normal ); //if normals are opposite, flip sense of surface_ptr if( fabs(ref_face_normal.interior_angle( surface_normal ) - 180 ) < 0.1 ) merged_face->reverse_normal(); //One more thing.....if surface is a composite, update the graphics //on the hidden curve...could have been deleted. if ( GeometryQueryTool::instance()->ige_is_composite( surface_ptr ) ) AppUtil::instance()->send_event(GeometryEvent(GeometryEvent::TOPOLOGY_MODIFIED, merged_face)); } //fix up merged edges -- some might need to be reversed for(i=ref_edge_list.size(); i--; ) { RefEdge *merged_edge = ref_edge_list.get_and_step(); BasicTopologyEntity *bte = static_cast<BasicTopologyEntity*>(merged_edge); //get the first bridge of the entity DLIList<TopologyBridge*> edge_bridge_list; bte->bridge_manager()->get_bridge_list( edge_bridge_list ); //get start/end points of the edge CubitVector edge_start_point = merged_edge->start_vertex()->coordinates(); CubitVector edge_end_point = merged_edge->end_vertex()->coordinates(); //get start/end point of the curve edge_bridge_list.reset(); Curve *curve_ptr = CAST_TO( edge_bridge_list.get(), Curve); DLIList<TBPoint*> tmp_points; curve_ptr->points( tmp_points ); CubitVector curve_start_point = tmp_points.get_and_step()->coordinates(); CubitVector curve_end_point = tmp_points.get_and_step()->coordinates(); //check to see if curve sense needs to be reversed if( edge_start_point.distance_between( curve_start_point ) < GEOMETRY_RESABS && edge_end_point.distance_between( curve_end_point ) < GEOMETRY_RESABS ) { //do nothing...everything is fine continue; } else { if( edge_start_point.distance_between( curve_end_point ) < GEOMETRY_RESABS && edge_end_point.distance_between( curve_start_point ) < GEOMETRY_RESABS ) { //switch sense of ref entity merged_edge->reverse_tangent(); } } } }
CubitBoolean GeometryModifyTool::get_all_edges_imprint | ( | ) | [inline, static] |
Gets all edges imprint flag.
Definition at line 2487 of file GeometryModifyTool.hpp.
{return allEdgesImprint;}
static RefEntity* GeometryModifyTool::get_copy_entity | ( | ) | [inline, static] |
Gets the entity being copied, if any.
Definition at line 1154 of file GeometryModifyTool.hpp.
{ return copyingEntity; }
double GeometryModifyTool::get_diff_from_multiple_of_90 | ( | double | angle | ) |
double GeometryModifyTool::get_dihedral_angle_score | ( | RefFace * | f1, |
RefFace * | f2, | ||
RefEdge * | common_edge | ||
) |
double GeometryModifyTool::get_edge_type_score | ( | RefEdge * | common_edge, |
double | small_curve_size | ||
) |
GeometryModifyEngine * GeometryModifyTool::get_engine | ( | TopologyBridge * | tb_ptr | ) | const |
Gets the GeometryModifyEngine of this entity.
Definition at line 11933 of file GeometryModifyTool.cpp.
{ int i; GeometryModifyEngine *gme; for (i = 0; i < gmeList.size(); i++) { gme = gmeList.next(i); if (gme->is_modify_engine(tb_ptr)) return gme; } return NULL; }
GeometryModifyEngine * GeometryModifyTool::get_engine | ( | TopologyEntity * | te_ptr, |
TopologyBridge ** | bridge = 0 |
||
) | const |
Gets the GeometryModifyEngine of this entity.
Definition at line 11944 of file GeometryModifyTool.cpp.
{ int i; GeometryModifyEngine *gme = 0; TopologyBridge* tb_ptr = NULL; BridgeManager* bm = te_ptr->bridge_manager(); DLIList<TopologyBridge*> bridges(bm->number_of_bridges()); bm->get_bridge_list(bridges); bridges.reset(); for (i = bridges.size(); !gme && i--; ) { tb_ptr = bridges.get_and_step(); gme = get_engine(tb_ptr); } if (bridge && gme) *bridge = tb_ptr; return gme; }
GeometryModifyEngine * GeometryModifyTool::get_gme | ( | ) | const [inline] |
Gets the current active GeometryModifyEngine.
Definition at line 2515 of file GeometryModifyTool.hpp.
{ GeometryModifyEngine *gme = NULL; if (gmeList.size()) { const_cast<GeometryModifyTool*>(this)->gmeList.reset(); gme = gmeList.get(); } return gme; }
void GeometryModifyTool::get_gme_list | ( | DLIList< GeometryModifyEngine * > & | gme_list | ) | [inline] |
Returns a list of GeometryModifyEngines.
return the list of gme's
Definition at line 2508 of file GeometryModifyTool.hpp.
static CubitBoolean GeometryModifyTool::get_group_imprint | ( | ) | [inline, static] |
Gets group imprint flag.
Definition at line 1115 of file GeometryModifyTool.hpp.
{return groupImprint;}
void GeometryModifyTool::get_merged_curve_and_surface_ids | ( | DLIList< Body * > & | bodies, |
DLIList< int > & | merged_surface_ids, | ||
DLIList< int > & | merged_curve_ids | ||
) | const [private] |
Definition at line 20102 of file GeometryModifyTool.cpp.
{ int i; for( i=bodies.size(); i--; ) { DLIList<RefEntity*> merged_children; MergeTool::instance()->contains_merged_children( bodies.get_and_step(), merged_children ); int j; for( j=merged_children.size(); j--; ) { RefEntity *ref_ent = merged_children.get_and_step(); RefFace *ref_face = CAST_TO( ref_ent, RefFace ); if( ref_face ) merged_surface_ids.append( ref_face->id() ); else { RefEdge *ref_edge = CAST_TO( ref_ent, RefEdge ); if( ref_edge ) merged_curve_ids.append( ref_edge->id() ); } } } }
CubitStatus GeometryModifyTool::get_mid_plane | ( | RefFace * | ref_face_1, |
RefFace * | ref_face_2, | ||
Body * | body_to_trim_to, | ||
DLIList< RefFace * > & | mid_plane_surfs | ||
) | const |
From two surface, create a midplane, then trim it with a body.
Definition at line 12119 of file GeometryModifyTool.cpp.
{ if( ref_face1 == ref_face2 ) { PRINT_ERROR("Cannot create midplane between the same surface.\n" " Surface %d was entered twice\n", ref_face1->id() ); return CUBIT_FAILURE; } BodySM* body_sm_to_trim_to = body_to_trim_to->get_body_sm_ptr(); GeometryModifyEngine *gme1_ptr = get_engine(body_sm_to_trim_to); if ( !gme1_ptr ) { PRINT_ERROR("Geometry can't be modified, no associated modify engine.\n"); return CUBIT_FAILURE; } CubitVector normal_1, normal_2, point_1, point_2, point_3; CubitPlane plane_1, plane_2; CubitVector p_mid, n_mid; point_1 = ref_face1->center_point(); point_2 = ref_face2->center_point(); normal_1 = ref_face1->normal_at(point_1); normal_2 = ref_face2->normal_at(point_2); plane_1 = CubitPlane(normal_1,point_1); plane_2 = CubitPlane(normal_2,point_2); if(point_1 == point_2) { PRINT_ERROR("Since both surfaces share the same point, the midplane is not well-defined\n"); return CUBIT_FAILURE; } else { CubitVector temp1 = point_2; temp1 = plane_1.project(temp1); temp1 -= point_2; if ( temp1.length_squared() < GEOMETRY_RESABS*GEOMETRY_RESABS ) { PRINT_ERROR("Since both planes are the same, the mid-plane is not well-defined.\n"); return CUBIT_FAILURE; } } if(plane_1.normal()==plane_2.normal() || plane_1.normal()==-plane_2.normal()) { p_mid = (point_1+point_2)/2; n_mid = plane_1.normal(); } else { CubitVector direction_of_line; plane_1.intersect(plane_2,p_mid,direction_of_line); direction_of_line.normalize(); // Find if point_1 and point_2 are on the line of intersection // If they are, then the mid-plane is not well-defined CubitVector p1 = point_1-p_mid; CubitVector p2 = point_2-p_mid; p1.normalize(); p2.normalize(); if(p1==direction_of_line || p1==-direction_of_line) { PRINT_ERROR("P1 is on the line of intersection.\n"); return CUBIT_FAILURE; } if(p2==direction_of_line || p2==-direction_of_line) { PRINT_ERROR("P2 is on the line of intersection.\n"); return CUBIT_FAILURE; } CubitVector v1 = p1 - (p1%direction_of_line)*direction_of_line; v1.normalize(); CubitVector v2 = p2 - (p2%direction_of_line)*direction_of_line; v2.normalize(); n_mid = v1 - v2; n_mid.normalize(); } CubitPlane mid_plane(n_mid, p_mid); point_1 = p_mid; //find three points that will define the infinite plane from the //mid plane. CubitVector test1(1,0,0), test1n(-1,0,0),test2(0,1,0); CubitVector direction1; //through the point in any direction just not along the //normal direction. if(n_mid != test1 && n_mid != test1n ) direction1 = test1 + n_mid; else direction1 = test2 + n_mid; point_2 = p_mid + direction1; point_2 = mid_plane.project(point_2); direction1 = point_2-point_1; CubitVector direction2 = direction1*n_mid; point_3 = point_1 + direction2; BodySM* midplane_body_sm = NULL; CubitStatus ret = gme1_ptr->get_mid_plane(point_1, point_2, point_3, body_sm_to_trim_to, midplane_body_sm ); if (midplane_body_sm) { Body *midplane_body; midplane_body = GeometryQueryTool::instance()->make_Body(midplane_body_sm); DLIList<RefFace*> ref_faces; midplane_body->ref_faces( ref_faces ); //make each surface of the body into its own body int i; for( i=0; i<ref_faces.size(); i++ ) { RefEntity *new_entity_ptr; new_entity_ptr = GeometryModifyTool::instance()->copy_refentity(ref_faces.get_and_step()); RefFace *ref_face_ptr = CAST_TO(new_entity_ptr, RefFace); mid_plane_surfs.append( ref_face_ptr ); } GeometryQueryTool::instance()->delete_Body( midplane_body ); } else return CUBIT_FAILURE; return ret; }
CubitStatus GeometryModifyTool::get_mid_surface | ( | RefFace * | ref_face_1, |
RefFace * | ref_face_2, | ||
Body * | body_to_trim_to, | ||
DLIList< RefFace * > & | mid_plane_surfs | ||
) | const |
Given 2 surfaces, this returns trimmed surfaces of the midsurface (this is an ALPHA feature).
Definition at line 12381 of file GeometryModifyTool.cpp.
{ if( ref_face1 == ref_face2 ) { PRINT_ERROR("Cannot create midplane between the same surface.\n" " Surface %d was entered twice\n", ref_face1->id() ); return CUBIT_FAILURE; } BodySM *body_sm_to_trim_to = body_to_trim_to->get_body_sm_ptr(); GeometryModifyEngine *gme1_ptr = get_engine(body_sm_to_trim_to); if ( !gme1_ptr ) { PRINT_ERROR("In GeometryModifyTool::get_mid_surface\n" " Geometry can't be modified, no associated modify engine.\n"); return CUBIT_FAILURE; } bool found_case = false; CubitStatus ret = CUBIT_SUCCESS; BodySM* midsurface_body_sm = NULL; // Plane to plane case if ( ( ref_face1->geometry_type() == PLANE_SURFACE_TYPE ) && ( ref_face2->geometry_type() == PLANE_SURFACE_TYPE ) ) { found_case = true; ret = get_planar_mid_surface( ref_face1, ref_face2, body_sm_to_trim_to, midsurface_body_sm, gme1_ptr ); } // Quadric to quadric cases if ( ( ( ref_face1->geometry_type() == SPHERE_SURFACE_TYPE ) && ( ref_face2->geometry_type() == SPHERE_SURFACE_TYPE ) ) || ( ( ref_face1->geometry_type() == CONE_SURFACE_TYPE ) && ( ref_face2->geometry_type() == CONE_SURFACE_TYPE ) ) || ( ( ref_face1->geometry_type() == TORUS_SURFACE_TYPE ) && ( ref_face2->geometry_type() == TORUS_SURFACE_TYPE ) ) ) { found_case = true; DLIList<TopologyEntity*> entity_list(2); DLIList<TopologyBridge*> bridge_list(2); entity_list.append(ref_face1); entity_list.append(ref_face2); GeometryModifyEngine* gme2_ptr = common_modify_engine(entity_list,bridge_list); if( gme2_ptr == 0 ) { PRINT_ERROR( "In GeometryModifyTool::get_mid_surface\n" " Surfaces %d and %d do not have the same underlying geometry modeling engine.\n" " For midsurface calculations, they must be the same\n", ref_face1->id(), ref_face2->id() ); return CUBIT_FAILURE; } if( gme1_ptr != gme2_ptr ) { PRINT_ERROR( "In GeometryModifyTool::get_mid_surface\n" " Body and surfaces do not have the same underlying geometry modeling engine.\n" " For midsurface calculations, they must be the same\n"); return CUBIT_FAILURE; } bridge_list.reset(); Surface* surface1_ptr = dynamic_cast<Surface*>(bridge_list.next(0)); Surface* surface2_ptr = dynamic_cast<Surface*>(bridge_list.next(1)); // Sphere to sphere case if ( ( ref_face1->geometry_type() == SPHERE_SURFACE_TYPE ) && ( ref_face2->geometry_type() == SPHERE_SURFACE_TYPE ) ) { ret = gme2_ptr->get_spheric_mid_surface( surface1_ptr, surface2_ptr, body_sm_to_trim_to, midsurface_body_sm ); } // Cone to cone case if ( ( ref_face1->geometry_type() == CONE_SURFACE_TYPE ) && ( ref_face2->geometry_type() == CONE_SURFACE_TYPE ) ) { ret = gme2_ptr->get_conic_mid_surface( surface1_ptr, surface2_ptr, body_sm_to_trim_to, midsurface_body_sm ); } // Torus to torus case if ( ( ref_face1->geometry_type() == TORUS_SURFACE_TYPE ) && ( ref_face2->geometry_type() == TORUS_SURFACE_TYPE ) ) { ret = gme2_ptr->get_toric_mid_surface( surface1_ptr, surface2_ptr, body_sm_to_trim_to, midsurface_body_sm ); } } // Unsupported pair of surfaces if ( ! found_case ) { PRINT_ERROR("In GeometryModifyTool::get_mid_surface\n" " Midsurface calculation not yet supported for such a pair of surfaces.\n"); return CUBIT_FAILURE; } if ( midsurface_body_sm ) { if(CubitUndo::get_undo_enabled()) CubitUndo::save_state(); DLIList<Surface*> mid_surfaces; DLIList<Body*> new_bodies; midsurface_body_sm->surfaces( mid_surfaces); //make each surface of the body into its own body int i; for( i=0; i<mid_surfaces.size(); i++ ) { Surface *tmp_surface = mid_surfaces.get_and_step(); Surface* new_surface_ptr = gme1_ptr->make_Surface( tmp_surface ); Body *new_Body = make_Body(new_surface_ptr); new_bodies.append( new_Body ); DLIList<RefFace*> ref_faces; new_Body->ref_faces(ref_faces); RefFace *ref_face_ptr = ref_faces.get(); mid_surface_surfs.append( ref_face_ptr ); } gme1_ptr->get_gqe()->delete_solid_model_entities( midsurface_body_sm ); if( CubitUndo::get_undo_enabled() ) { if( new_bodies.size() ) CubitUndo::note_result_bodies( new_bodies ); else CubitUndo::remove_last_undo(); } return ret; } else return CUBIT_FAILURE; }
double GeometryModifyTool::get_neighbor_type_score | ( | RefEdge * | common_edge, |
RefFace * | other_face, | ||
double | small_curve_size, | ||
int & | neighbor_is_narrow_or_small | ||
) |
void GeometryModifyTool::get_neighboring_bodies | ( | DLIList< Body * > & | input_bodies, |
DLIList< Body * > & | neighboring_bodies | ||
) | [private] |
static CubitBoolean GeometryModifyTool::get_new_ids | ( | ) | [inline, static] |
CubitStatus GeometryModifyTool::get_offset_intersections | ( | RefEdge * | ref_edge1, |
RefEdge * | ref_edge2, | ||
DLIList< CubitVector > & | intersection_list, | ||
double | offset, | ||
CubitBoolean | ext_first = CUBIT_TRUE |
||
) |
Finds the intersections of a certain distance (offset) between two curves.
Finds the intersections of a certain distance (offset) between two curves. The two curves must lie in a plane. The first curve is offset the offset distance in both directions, and the bounded intersections with the second curve are found. The first curve can optionally be extended to infinity for the intersection calculation. The intent of the function is so that the user can create a point on a curve a certain distance from another curve, as in specifying a reference location for a gage diameter on an arc in an engineering drawing. The function allocates the CubitVectors in the returned list, so be sure to free them.
Definition at line 11966 of file GeometryModifyTool.cpp.
{ DLIList<TopologyEntity*> entity_list(2); DLIList<TopologyBridge*> bridge_list(2); entity_list.append(ref_edge1); entity_list.append(ref_edge2); GeometryModifyEngine* gme_ptr1 = common_modify_engine(entity_list,bridge_list); if( gme_ptr1 == 0 ) { PRINT_ERROR( "Curves %d and %d do not have the same underlying geometry modeling engine\n" " For intersection calculations, they must be the same\n", ref_edge1->id(), ref_edge2->id() ); return CUBIT_FAILURE; } bridge_list.reset(); Curve* curve0 = dynamic_cast<Curve*>(bridge_list.next(0)); Curve* curve1 = dynamic_cast<Curve*>(bridge_list.next(1)); return gme_ptr1->get_offset_intersections( curve0, curve1, intersection_list, offset, ext_first ); }
CubitStatus GeometryModifyTool::get_offset_intersections | ( | RefEdge * | ref_edge_ptr, |
RefFace * | ref_face_ptr, | ||
DLIList< CubitVector > & | intersection_list, | ||
double | offset = 0.0 , |
||
CubitBoolean | ext_surf = CUBIT_TRUE |
||
) |
Finds intersections (points) of the curve and surface.
Finds intersections (points) of the curve and surface. The surface can be offset - it is offset to each side and intersections are found. By default the surface is extended to infinity (if possible) and the intersections are found. The function allocates the CubitVectors in the returned list, so be sure to free them.
Definition at line 11992 of file GeometryModifyTool.cpp.
{ // If curve is straight and surface is planar, compute their intersection; // otherwise use the geometry engine to do it. Curve* curve_ptr = ref_edge_ptr->get_curve_ptr(); Surface* surface_ptr = ref_face_ptr->get_surface_ptr(); if( curve_ptr == NULL ) { PRINT_ERROR("Unable to retrieve underlying geometric entity of Curve %d\n" " This is a bug - please report it\n", ref_edge_ptr->id() ); return CUBIT_FAILURE; } if( surface_ptr == NULL ) { PRINT_ERROR("Unable to retrieve underlying geometric entity of Surface %d\n" " This is a bug - please report it\n", ref_face_ptr->id() ); return CUBIT_FAILURE; } // If straight line and plane, find location right here analytically. CubitVector pln_origin, pln_normal; CubitVector crv_origin, crv_direction; if( ref_face_ptr->get_point_normal( pln_origin, pln_normal ) && ref_edge_ptr->get_point_direction( crv_origin, crv_direction ) ) { double pln_orig[3], pln_norm[3]; pln_orig[0]=pln_origin.x(); pln_orig[1]=pln_origin.y(); pln_orig[2]=pln_origin.z(); pln_norm[0]=pln_normal.x(); pln_norm[1]=pln_normal.y(); pln_norm[2]=pln_normal.z(); double crv_orig[3], crv_dir[3]; crv_orig[0]=crv_origin.x(); crv_orig[1]=crv_origin.y(); crv_orig[2]=crv_origin.z(); crv_dir[0]=crv_direction.x(); crv_dir[1]=crv_direction.y(); crv_dir[2]=crv_direction.z(); AnalyticGeometryTool *agt = AnalyticGeometryTool::instance(); if( agt->is_vec_perp( pln_norm, crv_dir ) ) { PRINT_ERROR( "Line is parallel to the plane - intersection not possible\n" ); return CUBIT_FAILURE; } double ang = agt->angle_vec_vec( pln_norm, crv_dir ); if( ang > AGT_PI_DIV_2 ) ang = AGT_PI - ang; double int_pnt[3]; agt->int_ln_pln( crv_orig, crv_dir, pln_orig, pln_norm, int_pnt ); // ang2 is angle between line and plane double ang2 = AGT_PI_DIV_2 - ang; double hypotenuse = offset/sin(ang2); double final_pnt[3]; agt->next_pnt( int_pnt, crv_dir, hypotenuse, final_pnt ); double end1[3], end2[3]; CubitVector start, end; start = ref_edge_ptr->start_coordinates(); end = ref_edge_ptr->end_coordinates(); end1[0]=start.x(); end1[1]=start.y(); end1[2]=start.z(); end2[0]=end.x(); end2[1]=end.y(); end2[2]=end.z(); CubitVector curve_position; if( agt->is_pnt_on_ln_seg( final_pnt, end1, end2 ) ) { curve_position.x( final_pnt[0] ); curve_position.y( final_pnt[1] ); curve_position.z( final_pnt[2] ); } else { agt->reverse_vec( crv_dir, crv_dir ); agt->next_pnt( int_pnt, crv_dir, hypotenuse, final_pnt ); if( agt->is_pnt_on_ln_seg( final_pnt, end1, end2 ) ) { curve_position.x( final_pnt[0] ); curve_position.y( final_pnt[1] ); curve_position.z( final_pnt[2] ); } else { PRINT_ERROR( "Resultant point does not lie on bounded curve\n" ); return CUBIT_FAILURE; } } intersection_list.append( curve_position ); } else { DLIList<TopologyEntity*> entity_list(2); DLIList<TopologyBridge*> bridge_list(2); entity_list.append(ref_edge_ptr); entity_list.append(ref_face_ptr); GeometryModifyEngine* gme_ptr1 = common_modify_engine(entity_list,bridge_list); if( gme_ptr1 == 0 ) { PRINT_ERROR( "Curve %d and Surface %d do not have the same underlying geometry modeling engine\n" " For intersection calculations, they must be the same\n", ref_edge_ptr->id(), ref_face_ptr->id() ); return CUBIT_FAILURE; } bridge_list.reset(); curve_ptr = dynamic_cast<Curve*>(bridge_list.next(0)); surface_ptr = dynamic_cast<Surface*>(bridge_list.next(1)); // Use geometry engine to find intersections return gme_ptr1->get_offset_intersections( curve_ptr, surface_ptr, intersection_list, offset, ext_surf ); } return CUBIT_FAILURE; }
static CubitBoolean GeometryModifyTool::get_old_names | ( | ) | [inline, static] |
double GeometryModifyTool::get_resultant_angle_score | ( | RefFace * | narrow_face, |
RefFace * | other_face, | ||
RefEdge * | common_edge | ||
) |
static CubitBoolean GeometryModifyTool::get_sep_after_webcut_setting | ( | ) | [inline, static] |
Gets sepAfterWebcut variable.
Definition at line 1957 of file GeometryModifyTool.hpp.
{return sepAfterWebcut;}
GeometryModifyEngine * GeometryModifyTool::group_bodies_by_engine | ( | DLIList< Body * > & | remaining_bodies, |
DLIList< Body * > & | engine_bodies, | ||
DLIList< BodySM * > & | engine_body_sms | ||
) | const |
Groups Bodies with the same underlying geometry engine into a list.
Get a subset of bodies from 'remaining_bodies' that share a common GeometryModifyEngine. Remove them from 'remaining_bodies', put the Bodies and corresponding BodySMs in 'engine_bodies' and 'engine_body_sms', and return the engine. Returns NULL if all bodies remaining in the list have no modify engine.
Definition at line 6368 of file GeometryModifyTool.cpp.
{ int i = remaining_bodies.size(); remaining_bodies.reset(); GeometryModifyEngine* engine = 0; if (i == 0) return 0; // Skip over any bodies that don't have a modify engine. while (i--) { Body* body = remaining_bodies.get(); TopologyBridge* bridge = 0; engine = get_engine(body, &bridge); if (engine) { remaining_bodies.change_to(0); engine_bodies.append(body); engine_body_sms.append(dynamic_cast<BodySM*>(bridge)); remaining_bodies.step(); break; } remaining_bodies.step(); } // catch case where no engine was found if (0 == engine) { PRINT_WARNING("No geometry modify engine found for this operation."); return engine; } // Get remaining bodies with same modify engine. while (i--) { Body* body = remaining_bodies.get(); TopologyBridge* bridge = 0; if (get_engine(body, &bridge) == engine) { remaining_bodies.change_to(0); engine_bodies.append(body); engine_body_sms.append(dynamic_cast<BodySM*>(bridge)); } remaining_bodies.step(); } remaining_bodies.remove_all_with_value(0); return engine; }
CubitStatus GeometryModifyTool::hollow | ( | DLIList< Body * > & | bodies, |
DLIList< RefFace * > | faces_to_remove, | ||
DLIList< Body * > & | new_bodies, | ||
double | depth | ||
) |
Definition at line 6848 of file GeometryModifyTool.cpp.
{ if (bodies.size() <= 0 || faces_to_remove.size() <= 0) { PRINT_WARNING("Needs at least one body and one face. Nothing modified\n"); return CUBIT_FAILURE; } if (!okay_to_modify( bodies, "HOLLOW" )) return CUBIT_FAILURE; // Get the GeometryEngine for each Body of the list to check // if they are the same and if they are GeometryModifyEngine const int count = bodies.size(); DLIList<TopologyEntity*> entity_list(count); DLIList<TopologyBridge*> bridge_list(count); CAST_LIST_TO_PARENT(bodies, entity_list); GeometryModifyEngine* gme = common_modify_engine( entity_list, bridge_list ); if (!gme) { PRINT_ERROR("Performing THICKEN with volumes containing geometry\n" " from different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } DLIList<BodySM*> new_sms(count); DLIList<BodySM*> body_sms(count); CAST_LIST(bridge_list, body_sms, BodySM); if( CubitUndo::get_undo_enabled() ) { CubitUndo::save_state_with_cubit_file( bodies ); } DLIList <Surface*> surfs_to_remove; for(int i = 0 ; i < faces_to_remove.size(); i++) { Surface* surf = faces_to_remove.get_and_step()->get_surface_ptr(); if(surf) surfs_to_remove.append(surf); } DLIList<int> merged_surface_ids; DLIList<int> merged_curve_ids; get_merged_curve_and_surface_ids( bodies, merged_surface_ids, merged_curve_ids ); do_attribute_setup(); // Push attributes down onto the bodies to be hollowed push_attributes_before_modify( body_sms ); CubitStatus result = gme->hollow( body_sms, surfs_to_remove, new_sms, depth); if( result == CUBIT_FAILURE ) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("Hollow failed\n"); remove_pushed_attributes(body_sms, bodies); do_attribute_cleanup(); return CUBIT_FAILURE; } // check for resued entities, they have been moved and we need to notify observers DLIList<RefEntity*> entities_to_update; int i; for(i=0; i<new_sms.size(); i++) { BodySM* bodysm = new_sms.get_and_step(); DLIList<TopologyBridge*> to_check; DLIList<TopologyBridge*> tmp; DLIList<Surface*> surfs; bodysm->surfaces(surfs); DLIList<Curve*> curves; bodysm->curves(curves); DLIList<TBPoint*> points; bodysm->points(points); to_check.append(bodysm); to_check.append(bodysm->lump()); CAST_LIST_TO_PARENT(surfs, tmp); to_check += tmp; CAST_LIST_TO_PARENT(curves, tmp); to_check += tmp; CAST_LIST_TO_PARENT(points, tmp); to_check += tmp; int k; for(k=0; k<to_check.size(); k++) if(BridgeManager* m = to_check.get_and_step()->bridge_manager()) if(TopologyEntity* t = m->topology_entity()) entities_to_update.append(CAST_TO(t, RefEntity)); } restore_vg_after_modify( new_sms, bodies, gme ); remove_pushed_attributes( new_sms, bodies ); result = finish_sm_op(bodies, new_sms, new_bodies); fixup_merged_entities( merged_surface_ids, merged_curve_ids); if (CUBIT_FAILURE == result) { if( CubitUndo::get_undo_enabled() ) CubitUndo::remove_last_undo(); PRINT_ERROR("Hollow failed\n"); do_attribute_cleanup(); return CUBIT_FAILURE; } else if( CubitUndo::get_undo_enabled() ) { CubitUndo::note_result_bodies( new_bodies ); } do_attribute_cleanup(); return CUBIT_SUCCESS; }
CubitStatus GeometryModifyTool::idealize_fillet_geometry | ( | DLIList< RefEntity * > | idealize_entity, |
DLIList< RefEntity * > | exclude_entity, | ||
double | fillet_rad, | ||
CubitBoolean | internal_flg, | ||
CubitBoolean | external_flg, | ||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Definition at line 12758 of file GeometryModifyTool.cpp.
{ //cast the DLIList<RefEntity> to a DLIList<RefFace> DLIList<RefFace*> face_to_idealize; CAST_LIST(idealize_entity, face_to_idealize, RefFace); //grabbing geometry tolerance double geo_tol = GeometryQueryTool::instance()->get_sme_resabs_tolerance(),temp_fillet_radius; //grabbing all the curve loops ONLY from surfaces which are a sheet body int y, i, j, z; DLIList<RefFace*> sheet_body_idealize_face; for(i=0; i<face_to_idealize.size(); i++) { RefFace* target_face = face_to_idealize.get_and_step(); DLIList<Shell*> shell_list; target_face->shells(shell_list); for(j=0; j<shell_list.size(); j++) { Shell* target_shell = shell_list.get_and_step(); if(target_face->is_nonmanifold( (GroupingEntity*)target_shell ) ) { sheet_body_idealize_face.append(face_to_idealize[i]); } } } face_to_idealize.clean_out(); //this section is going to remove all excluded curves loopsm from the 'master' loopsm list DLIList<Curve*> exclude_cuves; DLIList <Body*> old_body_list; if(exclude_entity.size()>0) { //cast the exclude DLIList<RefEntity> to DLIList<RefEdge> DLIList<RefEdge*> exclude_edge; CAST_LIST(exclude_entity, exclude_edge, RefEdge); //switching the DLIList<RefEdge> to DLIList<Curve> GeometryModifyEngine* gme_ptr1; gme_ptr1 = tweak_setup(exclude_edge,"idealize",old_body_list,exclude_cuves); if (NULL == gme_ptr1) { PRINT_ERROR("Unexpected NULL GeometryModifyEngine pointer.\n"); return CUBIT_FAILURE; } exclude_edge.clean_out(); } //switching the DLIList<RefFace> to DLIList<Surface> GeometryModifyEngine* gme_ptr; DLIList<Surface*> sheet_body_idealize_surface; gme_ptr = tweak_setup(sheet_body_idealize_face,"idealize",old_body_list,sheet_body_idealize_surface); sheet_body_idealize_face.clean_out(); //grab all the loops from each sheet body surface DLIList <LoopSM*> idealize_loopSM_list; for(y=0;y<sheet_body_idealize_surface.size();y++) { sheet_body_idealize_surface[y]->loopsms(idealize_loopSM_list); } sheet_body_idealize_surface.clean_out(); //search through possible fillet curves filtering only for curves of type arc //if it is an arc, does it have a straight line on both sides of it, if so' //check the radius of the arc and if it passes test add it to the list of curves to be tweaked removed DLIList <Curve*> master_curve_remove_list,possible_fillet_arcs,potential_fillet,internal_fillet, external_fillet, attached_curves; CubitVector fillet_center_point, intersection_pt,arc_mid,test_point; DLIList <TBPoint*> arc_vertices; for(y=0;y<idealize_loopSM_list.size();y++) { idealize_loopSM_list[y]->curves(possible_fillet_arcs); //doing this as a performance boost, it'll keep the code out of the next couple of for loops for situations //where there is no fillet possible, for instance, a hole with 2 curves will never be a fillet if(possible_fillet_arcs.size()>3) { for(i=0;i<possible_fillet_arcs.size();i++) { if(possible_fillet_arcs[i]->geometry_type() == ARC_CURVE_TYPE && exclude_cuves.is_in_list(possible_fillet_arcs[i])==CUBIT_FALSE) { possible_fillet_arcs[i]->points(arc_vertices); //don't need to check for one point as in a hole because I have a check that there needs to be //at least 3 curves in the loop //this is to check that there is only one curve attached to the arc for(z=0;z<arc_vertices.size();z++) { arc_vertices[z]->curves(attached_curves); if(attached_curves.size()!=2) { //I dont' think this break point is going to kick me far enough out of the for loop break; } } possible_fillet_arcs[i]->mid_point(arc_mid); possible_fillet_arcs[i]->get_center_radius(fillet_center_point,temp_fillet_radius); test_point = arc_mid + geo_tol * (fillet_center_point-arc_mid); DLIList<Surface*> test_surf; idealize_loopSM_list[y]->surfaces(test_surf); //this may be dangerous but I'm assuming that a loop is on only one surface CubitPointContainment cpc = test_surf[0]->point_containment(test_point); if(temp_fillet_radius <= fillet_rad && cpc==CUBIT_PNT_INSIDE) { external_fillet.append(possible_fillet_arcs[i]); } else if(temp_fillet_radius <= fillet_rad && cpc==CUBIT_PNT_OUTSIDE) { internal_fillet.append(possible_fillet_arcs[i]); } } } } possible_fillet_arcs.clean_out(); } if(internal_flg==CUBIT_TRUE) { master_curve_remove_list+=internal_fillet; } if(external_flg==CUBIT_TRUE) { master_curve_remove_list+=external_fillet; } //if no arcs are found to be removed, warn the user. if(master_curve_remove_list.size()==0) { PRINT_INFO( "Failed to find any fillets which met users requirements\n\n" ); //I'm returning success here even though no curves were found return CUBIT_SUCCESS; } else if(preview == CUBIT_TRUE) { DLIList<BodySM*> new_bodysm_list; bool old_error_flag = GET_ERROR_FLAG(); SET_ERROR_FLAG(false); // don't throw any tweak_remove errors CubitStatus stat = gme_ptr->tweak_remove(master_curve_remove_list, new_bodysm_list,CUBIT_FALSE, CUBIT_TRUE ); SET_ERROR_FLAG(old_error_flag); // turn errors back on if(stat==CUBIT_FAILURE) { PRINT_WARNING("At least one of the fillets which met your requirements \n" " can't be preview due to the curve's geometry\n"); } //output the number of holes or slots which were found PRINT_INFO("Found %d fillets which met idealization parameters\n\n", master_curve_remove_list.size()); return CUBIT_SUCCESS; } else { DLIList<BodySM*> new_bodysm_list; bool old_error_flag = GET_ERROR_FLAG(); SET_ERROR_FLAG(false); // don't throw any tweak_remove errors //pass master_curve_remove_list to the tweak_remove command CubitStatus stat = gme_ptr->tweak_remove(master_curve_remove_list, new_bodysm_list,CUBIT_FALSE, CUBIT_FALSE ); if(stat==CUBIT_FAILURE) { PRINT_WARNING("At least one of the fillets which met your requirements \n" " can't be tweaked due to the curve's geometry\n"); } SET_ERROR_FLAG(old_error_flag); // turn errors back on //update DAG DLIList<Body*> new_body_list; stat = finish_sm_op( old_body_list, new_bodysm_list ,new_body_list ); //output the number of holes or slots which were found PRINT_INFO("Found %d fillets which met idealization parameters\n\n", master_curve_remove_list.size()); return CUBIT_SUCCESS; } }
CubitStatus GeometryModifyTool::idealize_hole_slot_geometry | ( | DLIList< RefEntity * > | idealize_entity, |
DLIList< RefEntity * > | exclude_entity, | ||
double | arc_radius, | ||
double | slot_arc_radius, | ||
double | slot_length, | ||
CubitBoolean | preview = CUBIT_FALSE |
||
) |
Definition at line 12948 of file GeometryModifyTool.cpp.
{ //cast the DLIList<RefEntity> to a DLIList<RefFace> DLIList<RefFace*> face_to_idealize; CAST_LIST(idealize_entity, face_to_idealize, RefFace); //grabbing geometry tolerance double geo_tol = GeometryQueryTool::instance()->get_sme_resabs_tolerance(); //grabbing all the curve loops ONLY from surfaces which are a sheet body int y=0, i=0, j=0; DLIList<RefFace*> sheet_body_idealize_face; for(i=0; i<face_to_idealize.size(); i++) { RefFace* target_face = face_to_idealize.get_and_step(); DLIList<Shell*> shell_list; target_face->shells(shell_list); for(j=0; j<shell_list.size(); j++) { Shell* target_shell = shell_list.get_and_step(); if(target_face->is_nonmanifold( (GroupingEntity*)target_shell ) ) { sheet_body_idealize_face.append(face_to_idealize[i]); } } } //if no faces to idealize that pass requirements, error out a warning message if(sheet_body_idealize_face.size()==0) { //I'm returning success here even though no surfaces found that meet shell requirements set above { PRINT_INFO( "Failed to find any feature(s) which met user requirements\n\n" ); } return CUBIT_SUCCESS; } //temp_body_ptr = face_to_idealize[y]->body(); //if(temp_body_ptr->is_sheet_body()) //{ // sheet_body_idealize_face.append(face_to_idealize[y]); //} face_to_idealize.clean_out(); //switching the DLIList<RefFace> to DLIList<Surface> GeometryModifyEngine* gme_ptr; DLIList <Body*> old_body_list; DLIList<Surface*> sheet_body_idealize_surface; gme_ptr = tweak_setup(sheet_body_idealize_face,"idealize",old_body_list,sheet_body_idealize_surface); sheet_body_idealize_face.clean_out(); //grab all the loops from each sheet body surface DLIList <LoopSM*> idealize_loopSM_list; for(y=0;y<sheet_body_idealize_surface.size();y++) { sheet_body_idealize_surface[y]->loopsms(idealize_loopSM_list); } sheet_body_idealize_surface.clean_out(); //this section is going to remove all excluded curves loopsm from the 'master' loopsm list if(exclude_entity.size()>0) { //cast the exclude DLIList<RefEntity> to DLIList<RefEdge> DLIList<RefEdge*> exclude_edge; CAST_LIST(exclude_entity, exclude_edge, RefEdge); //switching the DLIList<RefEdge> to DLIList<Curve> DLIList<Curve*> exclude_cuves; GeometryModifyEngine* gme_ptr1; gme_ptr1 = tweak_setup(exclude_edge,"idealize",old_body_list,exclude_cuves); if (NULL == gme_ptr1) { PRINT_ERROR("Unexpected NULL GeometryModifyEngine pointer.\n"); return CUBIT_FAILURE; } exclude_edge.clean_out(); //grabbing all the curve loops from the given excluded curves DLIList <LoopSM*> exclude_loops; for(y=0;y<exclude_cuves.size();y++) { exclude_cuves[y]->loopsms(exclude_loops); } exclude_cuves.clean_out(); //remove the excluded loops from the list of sheet body loopsms idealize_loopSM_list -= exclude_loops; } //removing all the external loops from the list as they will not be tweak removed DLIList <LoopSM*> possible_internal_LoopSM_list; for(y=0;y<idealize_loopSM_list.size();y++) { if(idealize_loopSM_list[y]->loop_type() == LOOP_TYPE_HOLE) { possible_internal_LoopSM_list.append(idealize_loopSM_list[y]); } } idealize_loopSM_list.clean_out(); DLIList <Curve*> hole_curves_to_remove; //hole_curves_to_remove is the curves selected for removal out of the 'hole' search algorithm DLIList <Curve*> master_curve_remove_list; DLIList <LoopSM*> arc_LoopSM_list; DLIList <Surface*> temp_list; //this begins the hole search algorithm //if no arc radius given, skip hole search algorithm if(arc_radius!=CUBIT_DBL_MAX) { DLIList <LoopSM*> not_hole_loop; //loops which don't meet the all curves are arc type filter DLIList <Curve*> possible_internal_arcs; //search through possible internal curves filtering only for curves of type arc //if one of the curves in a loop is not an arc, add that loop to the not_hole_loop list for(y=0;y<possible_internal_LoopSM_list.size();y++) { possible_internal_arcs.clean_out(); possible_internal_LoopSM_list[y]->curves(possible_internal_arcs); for(i=0;i<possible_internal_arcs.size();i++) { temp_list.clean_out(); possible_internal_arcs[i]->surfaces(temp_list); //check whether or not curve is of arc type and whether it is attached to more than one surface if( possible_internal_arcs[i]->geometry_type() != ARC_CURVE_TYPE || temp_list.size() != 1) { not_hole_loop.append(possible_internal_LoopSM_list[y]); break; } } } //change name of possible_internal_LoopSM_list to arc_LoopSM_list arc_LoopSM_list = possible_internal_LoopSM_list; //subtract from the possible loops the loops which don't have curves which are all arcs or are attached to more than two surfaces arc_LoopSM_list-=not_hole_loop; not_hole_loop.clean_out(); //this next filter checks to make sure that all arcs of the same loop share the same //radius center within the geometry tolerance CubitVector arc_center_point, arc_center_point1; DLIList <LoopSM*> not_center_arc_loop; double rad_distance, temp_arc_radius , temp_arc_radius1; //this for loop is going to check that each loops arc curves have the same center radius point //if not you can remove that loop as a possibility for being added to the tweak_remove command for(y=0;y<arc_LoopSM_list.size();y++) { //clean out curve list before grabbing a new loop hole_curves_to_remove.clean_out(); arc_LoopSM_list[y]->curves(hole_curves_to_remove); //iterate across the hole_curves_to_remove size for (i=0;i<hole_curves_to_remove.size();i++) { //if you are on the first index, we need to set a baseline radius point if(i==0) { hole_curves_to_remove[i]->get_center_radius(arc_center_point,temp_arc_radius); //if this is the only arc in the loop go ahead and check if it meets specified arc parameter //if it doesn't meet the users parameter add the loop to the not_center_arc_loop list if(temp_arc_radius >= arc_radius && hole_curves_to_remove.size()==1) { not_center_arc_loop.append(arc_LoopSM_list[y]); break; } } //now compare the other arc center points to the baseline, if it ever fails the users parameter //add the loop to the not_center_arc_loop list else { hole_curves_to_remove[i]->get_center_radius(arc_center_point1,temp_arc_radius1); rad_distance = arc_center_point.distance_between_squared(arc_center_point1); if(rad_distance > geo_tol || temp_arc_radius >= arc_radius) { not_center_arc_loop.append(arc_LoopSM_list[y]); break; } } } } //remove loops which didn't have perfect circular holes from the arc_loopsm_list arc_LoopSM_list -= not_center_arc_loop; for(y=0;y<arc_LoopSM_list.size();y++) { arc_LoopSM_list[y]->curves(hole_curves_to_remove); } master_curve_remove_list+=hole_curves_to_remove; } //this begins the slot search algorithm DLIList<LoopSM*> removable_slot_loop; if(slot_arc_radius!=CUBIT_DBL_MAX || slot_length!=CUBIT_DBL_MAX) { DLIList<LoopSM*> four_curve_possible_slot; DLIList<LoopSM*> possible_slot; DLIList<Curve*> internal_curves_in_loop; //checks to make sure the loop has only four curves - may want to expand this in the future for(y=0;y<possible_internal_LoopSM_list.size();y++) { possible_internal_LoopSM_list[y]->curves(internal_curves_in_loop); if(internal_curves_in_loop.size()==4) { four_curve_possible_slot.append(possible_internal_LoopSM_list[y]); } internal_curves_in_loop.clean_out(); } //check to make sure it alternates straight line, arc, etc... for(y=0;y<four_curve_possible_slot.size();y++) { four_curve_possible_slot[y]->curves(internal_curves_in_loop); if(internal_curves_in_loop[0]->geometry_type() == ARC_CURVE_TYPE && internal_curves_in_loop[1]->geometry_type() == STRAIGHT_CURVE_TYPE && internal_curves_in_loop[2]->geometry_type() == ARC_CURVE_TYPE && internal_curves_in_loop[3]->geometry_type() == STRAIGHT_CURVE_TYPE) { int num_of_surfs=0; for(i=0;i<internal_curves_in_loop.size();i++) { temp_list.clean_out(); internal_curves_in_loop[i]->surfaces(temp_list); num_of_surfs=num_of_surfs + temp_list.size(); } if(num_of_surfs==4) { possible_slot.append(four_curve_possible_slot[y]); } } else if(internal_curves_in_loop[0]->geometry_type() == STRAIGHT_CURVE_TYPE && internal_curves_in_loop[1]->geometry_type() == ARC_CURVE_TYPE && internal_curves_in_loop[2]->geometry_type() == STRAIGHT_CURVE_TYPE && internal_curves_in_loop[3]->geometry_type() == ARC_CURVE_TYPE) { int num_of_surfs=0; for(i=0;i<internal_curves_in_loop.size();i++) { temp_list.clean_out(); internal_curves_in_loop[i]->surfaces(temp_list); num_of_surfs=num_of_surfs + temp_list.size(); } if(num_of_surfs==4) { possible_slot.append(four_curve_possible_slot[y]); } } internal_curves_in_loop.clean_out(); } CubitVector arc_center_point; double temp_arc_radius = CUBIT_DBL_MAX, curve_length = CUBIT_DBL_MAX; //check to make sure that the rad and/or length meet users parameters for(y=0;y<possible_slot.size();y++) { possible_slot[y]->curves(internal_curves_in_loop); //if user specified rad, then passed rad_counter should = 2 after for loop completes //if length specified, length_counter should =2 after for loop completes int rad_counter = 0, length_counter = 0; for(i=0;i<internal_curves_in_loop.size();i++) { //if curve is an arc and user specified a radius enter if statement if( internal_curves_in_loop[i]->geometry_type() == ARC_CURVE_TYPE && slot_arc_radius!=CUBIT_DBL_MAX ) { //check the radius against the user inputed value internal_curves_in_loop[i]->get_center_radius(arc_center_point,temp_arc_radius); if(temp_arc_radius <= slot_arc_radius) { //if it passes rad test, add to rad_counter rad_counter++; } } else if(internal_curves_in_loop[i]->geometry_type() == STRAIGHT_CURVE_TYPE && slot_length!=CUBIT_DBL_MAX ) { //check the length against the user inputed value curve_length = internal_curves_in_loop[i]->get_arc_length(); if(curve_length <= slot_length) { //if it passes rad test, add to length_counter length_counter++; } } } //checks that if user specified length and radius constraint that its parameter passes for all four curves if(slot_length!=CUBIT_DBL_MAX && slot_arc_radius!=CUBIT_DBL_MAX && rad_counter==2 && length_counter==2) { removable_slot_loop.append(possible_slot[y]); } //if user only specified one length or arc parameter, it only needs to meet 2 criteria else if((slot_length!=CUBIT_DBL_MAX && length_counter==2) || (slot_arc_radius!=CUBIT_DBL_MAX && rad_counter==2)) { removable_slot_loop.append(possible_slot[y]); } internal_curves_in_loop.clean_out(); } //add removable loops curves to the master_curve_remove_list list for(y=0;y<removable_slot_loop.size();y++) { removable_slot_loop[y]->curves(master_curve_remove_list); } } //if no arcs are found to be removed, warn the user. if(master_curve_remove_list.size()==0) { //I'm returning success here even though no curves were found { PRINT_INFO( "Failed to find any feature(s) which met user requirements\n\n" ); } return CUBIT_SUCCESS; } else if(preview == CUBIT_TRUE) { GfxPreview::clear(); for(i=0; i<master_curve_remove_list.size();i++) { CubitStatus result; GMem g_mem; // get the graphics result = master_curve_remove_list[i]->get_geometry_query_engine()-> get_graphics( master_curve_remove_list[i], &g_mem ); if (result==CUBIT_FAILURE || g_mem.pointListCount == 0) { PRINT_WARNING("Unable to preview a curve\n" ); double len = master_curve_remove_list[i]-> length_from_u(master_curve_remove_list[i]->start_param(),master_curve_remove_list[i]->end_param()); PRINT_WARNING("Curve len: %f\n",len); } // Draw the polyline GfxPreview::draw_polyline( g_mem.point_list(), g_mem.pointListCount, CUBIT_BLUE_INDEX ); } //output the number of holes or slots which were found PRINT_INFO("Found %d holes and %d slots which met idealization parameters\n\n", arc_LoopSM_list.size(),removable_slot_loop.size()); GfxPreview::flush(); return CUBIT_SUCCESS; } else { DLIList<BodySM*> new_bodysm_list; //pass master_curve_remove_list to the tweak_remove command CubitStatus stat = gme_ptr->tweak_remove(master_curve_remove_list, new_bodysm_list,CUBIT_FALSE, CUBIT_FALSE ); if (CUBIT_SUCCESS != stat) { PRINT_ERROR("GeometryModifyEngine::tweak_remove failed.\n"); return stat; } //update DAG DLIList<Body*> new_body_list; stat = finish_sm_op( old_body_list, new_bodysm_list ,new_body_list ); //output the number of holes or slots which were found PRINT_INFO("Found %d holes, and %d slots which met idealization parameters\n\n", arc_LoopSM_list.size(), removable_slot_loop.size()); return CUBIT_SUCCESS; } }
CubitStatus GeometryModifyTool::imprint | ( | DLIList< Body * > & | from_body_list, |
DLIList< Body * > & | new_body_list, | ||
CubitBoolean | keep_old = CUBIT_FALSE |
||
) |
Imprints a group of bodies with one another.
Definition at line 7515 of file GeometryModifyTool.cpp.
{ if( from_body_list.size() == 1 ) { PRINT_WARNING("Need more than 1 body or volume to imprint.\n"); return CUBIT_FAILURE; } if (get_group_imprint() == CUBIT_FALSE) { CubitStatus result = imprint_singly( from_body_list, new_body_list, keep_old ); return result; } // Check the GeometryEngine for each of the Body's; check to // make sure they're all the same from_body_list.reset(); if (!okay_to_modify( from_body_list, "IMPRINT" )) return CUBIT_FAILURE; //Check for repeats in each individual list and for overlap //between the two lists. from_body_list.uniquify_ordered(); DLIList<BodySM*> from_sms(from_body_list.size()), new_sms; GeometryModifyEngine* gePtr1 = common_modify_engine(from_body_list, from_sms); if ( !gePtr1 ) { PRINT_ERROR("Performing IMPRINT with volumes containing geometry\n" "from different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } if( CubitUndo::get_undo_enabled() ) { if( keep_old ) CubitUndo::save_state(); else CubitUndo::save_state_with_cubit_file( from_body_list ); } int process_composites = 0; if(contains_composites(from_body_list)) process_composites = 1; if(process_composites) { // Push virtual attributes down to solid model topology before // doing the imprint. do_attribute_setup(); push_attributes_before_modify(from_sms); // This must be done after pushing the vg atts because it uses them. DLIList<TopologyBridge*> tb_list; CAST_LIST(from_sms, tb_list, TopologyBridge); push_named_attributes_to_curves_and_points(tb_list, "IMPRINTER"); push_named_attributes_to_curves_and_points(tb_list, "ORIGINAL"); } CubitStatus result = gePtr1->imprint(from_sms, new_sms, keep_old); int i, j; if(process_composites) { if(result == CUBIT_SUCCESS) { // Analyze the results and adjust virtual attributes as necessary. DLIList<TopologyBridge*> tb_list; CAST_LIST(new_sms, tb_list, TopologyBridge); GeometryQueryTool::instance()->ige_attribute_after_imprinting(tb_list, from_body_list); // Clean up attributes. remove_imprint_attributes_after_modify(from_sms, new_sms); // Restore the virtual geometry. restore_vg_after_modify(new_sms, from_body_list, gePtr1); } remove_pushed_attributes(new_sms, from_body_list); } if (get_old_names() == CUBIT_FALSE) { if (!finish_sm_op(from_body_list, new_sms, new_body_list)) result = CUBIT_FAILURE; if( CubitUndo::get_undo_enabled() ) { if( result == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( new_body_list ); else CubitUndo::remove_last_undo(); } if(process_composites) do_attribute_cleanup(); return result; } if(process_composites) do_attribute_cleanup(); // If old_names is true, need to make sure things are deleted in // the correct order so that entities get the same @A type extension // on their names. // Update existing bodies. from_body_list.reset(); for (i = from_body_list.size(); i--; ) { Body* body = from_body_list.get(); BodySM* body_sm = body->get_body_sm_ptr(); if (!body_sm) { GeometryQueryTool::instance()->destroy_dead_entity(body); from_body_list.change_to(0); } else { remove_dead_entity_names(body); GeometryQueryTool::instance()->make_Body(body_sm); } from_body_list.step(); } // Construct new bodies new_sms.reset(); for (j = new_sms.size(); j--; ) { BodySM* body_sm = new_sms.get_and_step(); Body* body = GeometryQueryTool::instance()->make_Body(body_sm); new_body_list.append(body); } GeometryQueryTool::instance()->cleanout_deactivated_geometry(); if( CubitUndo::get_undo_enabled() ) { if( result == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( new_body_list ); else CubitUndo::remove_last_undo(); } return result; }
CubitStatus GeometryModifyTool::imprint | ( | DLIList< Body * > & | body_list, |
DLIList< RefEdge * > & | ref_edge_list, | ||
DLIList< Body * > & | new_body_list, | ||
CubitBoolean | keep_old_body = CUBIT_FALSE , |
||
CubitBoolean | show_messages = CUBIT_TRUE |
||
) |
Imprints a list of Bodies with a list of RefEdges. Useful for.
Imprints a list of Bodies with a list of RefEdges. Useful for splitting surfaces. If edge pierces a surface a hardpoint will result at the pierce location. Interface is free of but currently only works if all entities are entities.
Definition at line 7972 of file GeometryModifyTool.cpp.
{ // Check the GeometryEngine for each of the bodies; check to // make sure they're all the same body_list.reset(); int i; if (!okay_to_modify( body_list, "IMPRINT" )) return CUBIT_FAILURE; const int count = body_list.size() + ref_edge_list.size(); DLIList<TopologyEntity*> entity_list(count); DLIList<TopologyBridge*> bridge_list(count); CAST_LIST_TO_PARENT(body_list, entity_list); ref_edge_list.reset(); for (i = ref_edge_list.size(); i--;) entity_list.append(ref_edge_list.get_and_step()); GeometryModifyEngine* gePtr1 = common_modify_engine(entity_list, bridge_list); DLIList<BodySM*> body_sm_list(body_list.size()); DLIList<Curve*> curve_list(ref_edge_list.size()); CAST_LIST(bridge_list, body_sm_list, BodySM); CAST_LIST(bridge_list, curve_list, Curve); if ( !gePtr1 || body_sm_list.size() != body_list.size() || curve_list.size() != ref_edge_list.size() ) { PRINT_ERROR("Performing IMPRINT with volumes containing geometry from\n" "different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } if( CubitUndo::get_undo_enabled() ) { if( keep_old_body ) CubitUndo::save_state(); else CubitUndo::save_state_with_cubit_file( body_list ); } int process_composites = 0; if(contains_composites(body_list)) process_composites = 1; if(process_composites) { // Turn certain attributes on. do_attribute_setup(); // Push virtual attributes down to solid model topology before // doing the imprint. push_attributes_before_modify(body_sm_list); // Put "ORIGINAL" attributes on the bodies being imprinted and // the curves as these originally existed. DLIList<TopologyBridge*> tb_list; CAST_LIST(body_sm_list, tb_list, TopologyBridge); push_named_attributes_to_curves_and_points(tb_list, "ORIGINAL"); tb_list.clean_out(); CAST_LIST(curve_list, tb_list, TopologyBridge); push_named_attributes_to_curves_and_points(tb_list, "ORIGINAL"); } DLIList<BodySM*> new_sm_list; // The bridges doing the imprinting often get split during the process but // because of the way we are making copies, the IMPRINTER attribute doesn't // get propagated to them. temporary_bridges will be filled in with any // additional IMPRINTER bridges we need to consider below when deciding whether to // keep composite attributes. DLIList<TopologyBridge*> temporary_bridges; CubitStatus status = gePtr1->imprint( body_sm_list, curve_list, new_sm_list, temporary_bridges, keep_old_body, show_messages); temporary_bridges.uniquify_ordered(); if(status == CUBIT_FAILURE) { if(process_composites) { remove_pushed_attributes(new_sm_list, body_list); do_attribute_cleanup(); } while(temporary_bridges.size()) { TopologyBridge* bridge = temporary_bridges.pop(); bridge->get_geometry_query_engine()->delete_topology_bridge(bridge); } return status; } else { if(process_composites) { DLIList<TopologyBridge*> tb_list; // Analyze the results and adjust virtual attributes as necessary. CAST_LIST(new_sm_list, tb_list, TopologyBridge); // The bridges coming back in temporary_bridges may not have IMPRINTER // attributes on them becuase of the way they were generated below. Make // sure they get IMPRINTER attributes. push_named_attributes_to_curves_and_points(temporary_bridges, "IMPRINTER"); tb_list += temporary_bridges; GeometryQueryTool::instance()->ige_attribute_after_imprinting(tb_list, body_list); // Clean up attributes. remove_imprint_attributes_after_modify(body_sm_list, new_sm_list); // Restore the virtual geometry. restore_vg_after_modify(new_sm_list, body_list, gePtr1); remove_pushed_attributes(new_sm_list, body_list); } } while(temporary_bridges.size()) { TopologyBridge* bridge = temporary_bridges.pop(); bridge->get_geometry_query_engine()->delete_topology_bridge(bridge); } status = finish_sm_op(body_list, new_sm_list, new_body_list); if(process_composites) do_attribute_cleanup(); if( CubitUndo::get_undo_enabled() ) { if( status == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( new_body_list ); else CubitUndo::remove_last_undo(); } return status; }
CubitStatus GeometryModifyTool::imprint | ( | DLIList< RefFace * > & | ref_face_list, |
DLIList< RefEdge * > & | ref_edge_list, | ||
DLIList< Body * > & | new_body_list, | ||
CubitBoolean | keep_old_body = CUBIT_FALSE |
||
) |
Imprints a list of RefFaces with a list of RefEdges. This is.
Imprints a list of RefFaces with a list of RefEdges. This is useful if the user has a curve which spans several surfaces on a body and only wants to imprint to selected surfaces. Algorithm does not support imprinting to free surfaces. This method is not as reliable as the function to imprint a curve to a body. Interface is free of but currently only works if all entities are entities. Imprints a list of Surfaces with list of Curves, sorted per Surface (ie., curve_lists_list is same length as surface_list). This version is more efficient than the general-purpose one above, as we know which curves to imprint with which surfaces. Also, the Curves need not be RefEntities. All input surfaces must be from the same body however.
Definition at line 8113 of file GeometryModifyTool.cpp.
{ for(int j=0;j<ref_edge_list.size();j++) { RefEdge* edge=ref_edge_list[j]; if(edge->get_arc_length()<=edge->get_geometry_query_engine()->get_sme_resabs_tolerance()) { PRINT_ERROR( "Curve %d has zero length.\n To imprint curve as a hard point use the vertex of the curve.\n",edge->id() ); return CUBIT_FAILURE; } } //get the owning bodies of the faces and edges DLIList<Body*> body_list; int j; for(j=ref_face_list.size(); j--;) ref_face_list.get_and_step()->bodies( body_list ); for(j=ref_edge_list.size(); j--;) ref_edge_list.get_and_step()->bodies( body_list ); body_list.uniquify_ordered(); if (!okay_to_modify( body_list, "IMPRINT" )) return CUBIT_FAILURE; DLIList<TopologyEntity*> temp_list, temp_list_2, body_me_list; CAST_LIST_TO_PARENT(ref_face_list, temp_list); CAST_LIST_TO_PARENT(ref_edge_list, temp_list_2); temp_list += temp_list_2; ModelQueryEngine::instance()->query_model(temp_list, DagType::body_type(), body_me_list ); DLIList<Surface*> surf_list(ref_face_list.size()); DLIList<Curve*> curve_list(ref_edge_list.size()); GeometryModifyEngine* gePtr1 = common_modify_engine( ref_face_list,ref_edge_list,surf_list, curve_list,true); if ( !gePtr1 ) { PRINT_ERROR("Performing IMPRINT with volumes containing geometry from\n" "different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } if( CubitUndo::get_undo_enabled() ) { if( keep_old_body ) CubitUndo::save_state(); else CubitUndo::save_state_with_cubit_file( ref_face_list ); } int process_composites = 0; if(contains_composites(body_list)) process_composites = 1; int i; DLIList<BodySM*> body_sm_list; if(process_composites) { // Turn certain attributes on. do_attribute_setup(); for(i=body_list.size(); i--;) body_sm_list.append_unique(body_list.get_and_step()->get_body_sm_ptr()); // Push virtual attributes down to solid model topology before // doing the imprint. push_attributes_before_modify(body_sm_list); // Put "ORIGINAL" attributes on the bodies being imprinted and // the curves as these originally existed. DLIList<TopologyBridge*> tmp_tb_list; CAST_LIST(surf_list, tmp_tb_list, TopologyBridge); push_named_attributes_to_curves_and_points(tmp_tb_list, "ORIGINAL"); } DLIList<BodySM*> new_sm_list; // The bridges doing the imprinting often get split during the process but // because of the way we are making copies, the IMPRINTER attribute doesn't // get propagated to them. temporary_bridges will be filled in with any // additional IMPRINTER bridges we need to consider below when deciding whether to // keep composite attributes. DLIList<TopologyBridge*> temporary_bridges; CubitStatus status = gePtr1->imprint( surf_list, curve_list, temporary_bridges, new_sm_list, keep_old_body ); temporary_bridges.uniquify_ordered(); if(process_composites) { // Analyze the results and adjust virtual attributes as necessary. DLIList<TopologyBridge*> tb_list; CAST_LIST(new_sm_list, tb_list, TopologyBridge); // The bridges coming back in temporary_bridges may not have IMPRINTER // attributes on them becuase of the way they were generated below. Make // sure they get IMPRINTER attributes. push_named_attributes_to_curves_and_points(temporary_bridges, "IMPRINTER"); tb_list += temporary_bridges; GeometryQueryTool::instance()->ige_attribute_after_imprinting(tb_list, body_list); // Clean up attributes. remove_imprint_attributes_after_modify(body_sm_list, new_sm_list); restore_vg_after_modify(body_sm_list, body_list, gePtr1); remove_pushed_attributes(body_sm_list, body_list); } while(temporary_bridges.size()) { TopologyBridge* bridge = temporary_bridges.pop(); bridge->get_geometry_query_engine()->delete_topology_bridge(bridge); } CubitStatus status2 = finish_sm_op(body_list, new_sm_list, new_body_list); if(process_composites) do_attribute_cleanup(); if( CubitUndo::get_undo_enabled() ) { if( status == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( new_body_list ); else CubitUndo::remove_last_undo(); } if( status == CUBIT_SUCCESS && status2 == CUBIT_SUCCESS) return status; else return CUBIT_FAILURE; }
CubitStatus GeometryModifyTool::imprint | ( | DLIList< Surface * > & | surface_list, |
DLIList< DLIList< Curve * > * > & | curve_lists_list, | ||
Body *& | new_body, | ||
CubitBoolean | keep_old_body = CUBIT_FALSE , |
||
CubitBoolean | expand = CUBIT_TRUE |
||
) |
Imprints a list of Surfaces with list of Curves, sorted per.
Definition at line 8245 of file GeometryModifyTool.cpp.
{ int i; DLIList<Curve*> *curve_list_ptr; // Check to see if any curves exist - if none, just exit int have_curves = 0; for( i=curve_lists_list.size(); i--; ) { curve_list_ptr = curve_lists_list.get_and_step(); for(int j=0;j<curve_list_ptr->size();j++) { Curve* curve=(*curve_list_ptr)[j]; if(curve->get_arc_length()<=curve->get_geometry_query_engine()->get_sme_resabs_tolerance()) { RefEdge* edge = dynamic_cast<RefEdge*>(curve->topology_entity()); if(edge) { PRINT_ERROR( "Curve %d has zero length.\n To imprint as a hard point use the vertex of the curve.\n",edge->id() ); return CUBIT_FAILURE; } else { return CUBIT_FAILURE; } } else { have_curves++; break; } } } if( !have_curves ) return CUBIT_SUCCESS; // Get parent bodies DLIList<Body*> old_body_list; surface_list.reset(); for( i=surface_list.size(); i--; ) { Surface *surf_ptr = surface_list.get_and_step(); RefEntity* ref_ent = dynamic_cast<RefEntity*>(surf_ptr->topology_entity()); RefFace *ref_face_ptr = CAST_TO( ref_ent, RefFace ); if( ref_face_ptr ) { DLIList<Body*> body_list; ref_face_ptr->bodies( body_list ); old_body_list.merge_unique( body_list ); } } if( old_body_list.size() > 1 ) { PRINT_ERROR( "This operation requires all surfaces to be from the same volume\n" ); // Note: this restriction could be pretty easily lifted by sorting the // input lists and calling the GeometryModifyEngine for each body // separately, or having engines handle this. return CUBIT_FAILURE; } // In order to support imprinting on composite surfaces we will // get any surfaces underlying the surfaces passed in. For now // we will only do this if a single surface is coming in but // it could be extended for multiple surfaces as well. DLIList<Surface*> new_surface_list; if(surface_list.size() == 1) { GeometryQueryEngine *gqe = surface_list.get()->get_geometry_query_engine(); DLIList<TopologyBridge*> tbs; gqe->get_underlying_surfaces(surface_list.get(), tbs); if(tbs.size() > 0) { for(int k=tbs.size(); k--;) new_surface_list.append(dynamic_cast<Surface*>(tbs.get_and_step())); } else new_surface_list.append(surface_list.get()); } else new_surface_list = surface_list; // Check engines - must all be the same GeometryModifyEngine* gme; new_surface_list.reset(); gme = get_engine( new_surface_list.get() ); for( i=new_surface_list.size(); i--; ) { Surface *surf_ptr = new_surface_list.get_and_step(); GeometryModifyEngine* gme2 = get_engine( surf_ptr ); if( gme != gme2 ) { PRINT_ERROR( "All surfaces being imprinted must be from the same geometry engine\n" ); return CUBIT_FAILURE; } } int j; for( i=curve_lists_list.size(); i--; ) { curve_list_ptr = curve_lists_list.get_and_step(); for( j=curve_list_ptr->size(); j--; ) { Curve *curve_ptr = curve_list_ptr->get_and_step(); GeometryModifyEngine* gme2 = get_engine( curve_ptr ); if( gme != gme2 ) { PRINT_ERROR( "Curves used to imprint must be from same geometry engine as Surface\n" ); return CUBIT_FAILURE; } } } if( CubitUndo::get_undo_enabled() ) { if( keep_old_body ) CubitUndo::save_state(); else CubitUndo::save_state_with_cubit_file( old_body_list ); } int process_composites = 0; if(contains_composites(old_body_list)) process_composites = 1; BodySM* new_body_sm = 0; DLIList<BodySM*> body_sm_list; DLIList<TopologyBridge*> tb_list; if(process_composites) { do_attribute_setup(); for(i=old_body_list.size(); i--;) body_sm_list.append_unique(old_body_list.get_and_step()->get_body_sm_ptr()); push_attributes_before_modify(body_sm_list); // push_imprint_attributes_before_modify(body_sm_list); DLIList<TopologyBridge*> tmp_tb_list; CAST_LIST(new_surface_list, tmp_tb_list, TopologyBridge); push_named_attributes_to_curves_and_points(tmp_tb_list, "ORIGINAL"); for(i=curve_lists_list.size(); i>0; i--) { DLIList<Curve*> *cur_list = curve_lists_list.get_and_step(); for(j=cur_list->size(); j>0; j--) { Curve *cur_curve = cur_list->get_and_step(); tb_list.append(cur_curve); } } push_named_attributes_to_curves_and_points(tb_list, "IMPRINTER"); } CubitStatus status = gme->imprint( new_surface_list, curve_lists_list, new_body_sm, keep_old_body, expand); DLIList<Body*> new_body_list; DLIList<BodySM*> new_sm_list; new_sm_list.append( new_body_sm ); if(process_composites) { // Analyze the results and adjust virtual attributes as necessary. DLIList<TopologyBridge*> tmp_tb_list; CAST_LIST(new_sm_list, tmp_tb_list, TopologyBridge); tb_list += tmp_tb_list; GeometryQueryTool::instance()->ige_attribute_after_imprinting(tb_list, old_body_list); // Clean up attributes. remove_imprint_attributes_after_modify(body_sm_list, new_sm_list); restore_vg_after_modify(body_sm_list, old_body_list, gme); remove_pushed_attributes(body_sm_list, old_body_list); } CubitStatus status2 = finish_sm_op(old_body_list, new_sm_list, new_body_list); if(process_composites) do_attribute_cleanup(); if( CubitUndo::get_undo_enabled() ) { if( status == CUBIT_SUCCESS ) CubitUndo::note_result_bodies( new_body_list ); else CubitUndo::remove_last_undo(); } if( status == CUBIT_SUCCESS && status2 == CUBIT_SUCCESS) return status; else return CUBIT_FAILURE; }
CubitStatus GeometryModifyTool::imprint | ( | DLIList< Body * > & | body_list, |
DLIList< CubitVector > & | vector_list, | ||
DLIList< Body * > & | new_body_list, | ||
CubitBoolean | keep_old_body = CUBIT_FALSE , |
||
CubitBoolean | merge = CUBIT_FALSE |
||
) |
Imprints a list of bodies to a list of locations.
Imprints a list of bodies to a list of locations. Useful for splitting curves and creating hardpoints on surfaces. Interface is free of but currently only works if bodies are bodies.
Definition at line 8445 of file GeometryModifyTool.cpp.
{ // Check the GeometryEngine for each of the RefEdges; check to // make sure they're all the same body_list.reset(); if (!okay_to_modify( body_list, "IMPRINT" )) return CUBIT_FAILURE; DLIList<BodySM*> body_sm_list(body_list.size()), new_sm_list; GeometryModifyEngine* gePtr1 = common_modify_engine(body_list, body_sm_list); if ( !gePtr1 ) { PRINT_ERROR("Performing IMPRINT with volumes containing geometry from\n" "different modeling engines is not allowed.\n" "Delete uncommon geometry on these volumes before operation.\n\n"); return CUBIT_FAILURE; } if( CubitUndo::get_undo_enabled() ) { if( keep_old_body ) CubitUndo::save_state(); else CubitUndo::save_state_with_cubit_file( body_list ); } int process_composites = 0; if(contains_composites(body_list)) process_composites = 1; int i; DLIList<TopologyBridge*> temporary_bridges; if(process_composites) { // Turn certain attributes on. do_attribute_setup(); // Push virtual attributes down to solid model topology before // doing the imprint. push_attributes_before_modify(body_sm_list); // Create temporary bridges for the vector positions. We do // this so that we can put an IMPRINTER attribute on them // and use them later for deciding whether to keep composite // attributes or not. for(i=vector_list.size(); i>0; i--) { CubitVector vec = vector_list.get_and_step(); TBPoint *pt = gePtr1->make_Point(vec); temporary_bridges.append(pt); } push_named_attributes_to_curves_and_points(temporary_bridges, "IMPRINTER"); DLIList<TopologyBridge*> tmp_tb_list; CAST_LIST(body_sm_list, tmp_tb_list, TopologyBridge); // Put "ORIGINAL" attributes on the bridges that originally existed. push_named_attributes_to_curves_and_points(tmp_tb_list, "ORIGINAL"); } CubitStatus status = gePtr1->imprint( body_sm_list, vector_list,new_sm_list, keep_old_body); temporary_bridges.uniquify_ordered(); if(process_composites) { // Analyze the results and adjust virtual attributes as necessary. DLIList<TopologyBridge*> tb_list; CAST_LIST(new_sm_list, tb_list, TopologyBridge); tb_list += temporary_bridges; GeometryQueryTool::instance()->ige_attribute_after_imprinting(tb_list, body_list); while(temporary_bridges.size()) { TopologyBridge* bridge = temporary_bridges.pop(); bridge->get_geometry_query_engine()->delete_topology_bridge(bridge); } // Clean up attributes. remove_imprint_attributes_after_modify(body_sm_list, new_sm_list); // Restore the virtual geometry. restore_vg_after_modify(new_sm_list, body_list, gePtr1); remove_pushed_attributes(new_sm_list, body_list); } CubitStatus status2 = finish_sm_op(body_list, new_sm_list, new_body_list); if(process_composites) do_attribute_cleanup(); if( merge ) { DLIList<Body*> bodies_to_merge; int i; for( i=new_body_list.size(); i--; ) { Body *tmp_body = new_body_list.get_and_step(); DLIList<RefEdge*> ref_edge_list; tmp_body->ref_edges( ref_edge_list ); int j; for( j=ref_edge_list.size(); j--; ) { RefEdge *tmp_edge = ref_edge_list.get_and_step(); DLIList<Body*> body_list; tmp_edge->bodies<