Home
Reply
Contributor
swapnalir
Posts: 9

Mesh Api fails for some polygon boundary values

I did some code for Polygon mesh :  The code worked for values in code.

But nw i m trying with some different values as

 

 

SPAposition * pos_array = ACIS_NEW SPAposition[5];
        pos_array[0] = SPAposition(15.585800,32.236699,0);
        pos_array[1] = SPAposition(15.585800,42.887599,0);
        pos_array[2] = SPAposition(35.254400,42.887599,0);
        pos_array[3] = SPAposition(35.254400,32.236699,0);
        pos_array[4] = SPAposition(15.585800,32.236699,0);
        result = api_make_wire (my_body, 5, pos_array, my_body);

 

 

For those values the code below doesnt give me af_query output.

 

Please help me on this ASAP

 

 

 

following is the code snippet.

API_BEGIN
            
            BODY *body = NULL;
            SPAposition * pos_array = ACIS_NEW SPAposition[7];
        pos_array[0] = SPAposition(1.3341,0.4307,0);
        pos_array[1] = SPAposition(1.3266,-0.1385,0);
        pos_array[2] = SPAposition(0.1852,-0.1610,0);
        pos_array[3] = SPAposition(0.1066,0.5805,0);
        pos_array[4] = SPAposition(0.4958,0.2134,0);
        pos_array[5] = SPAposition(0.7353,0.4943,0);
        pos_array[6] = SPAposition(1.3341,0.4307,0);
 
           
        result = api_make_wire (body, 7, pos_array, body);
          
            ACIS_DELETE [] pos_array;  // De-allocate the array.
 
      
        WIRE * my_wire = body->lump()->shell()->wire();
 
 

        FACE *face = NULL;
        result = api_cover_wire (my_wire, *(surface*)NULL_REF, face);

        result = api_body_to_2d (body);

        MESH_MANAGER * MM = NULL;
        MESH_MANAGER * oldMM;
        
        outcome o1 = api_get_mesh_manager( oldMM );
        check_outcome(o1);
        MM = new INDEXED_MESH_MANAGER;
        
        o1 = api_set_mesh_manager(MM);
        check_outcome(o1);
        REFINEMENT* ref;
        o1 = api_create_refinement(ref);
        
        api_set_entity_refinement((ENTITY *)face, ref, FALSE);
        POLYGON_POINT_MESH *facets = (POLYGON_POINT_MESH*)NULL;

        facet_options_visualization my_opts;
        face_quality_level level;
        level = medium_fine;
        my_opts.set_face_quality(medium_fine);

        facet_options_precise my_opt1;
        my_opt1.set_max_edge_length(0.01);
       

        result = api_facet_entity((ENTITY *)face,&my_opt1);
        result = api_get_face_facets(face,facets);
        check_outcome(result);

        int facetCount = facets->size(); //facets->count();
        
        MESH * face_mesh = NULL;
        af_query((ENTITY*)face, IDX_MESH_APP, IDX_MESH_ID, face_mesh);
        INDEXED_MESH * mesh = (INDEXED_MESH*)face_mesh;

Spatial Employee
asdf
Posts: 93

Re: Mesh Api fails for some polygon boundary values

Hi

 

I don't know what is wrong yet, but I have a couple of suggestions and a request.  First the suggestions: you have used a mix of the current APIs as well as some obsolete ones.  You shouldn't be using api_get_face_facets, especially not with an indexed mesh.  That API only gives a result if you are using the POINT_POLYGON_MESH_MANAGER, and according to the comments, should only be used for faceting prior to ACIS1.7.  Second, you don't need to put a refinement on the face you are faceting.  The facet options should suffice.  You may also want to look at http://doc.spatial.com/index.php/Getting_Started_with_the_ACIS_Faceter if you haven't already.

 

One other thing which might help: separate the code for building the geometry from the code for generating the mesh.  The documentation page I linked to earlier provides sample code for getting at a mesh after you load a sat file.  After you make the sheet body, it is fairly easy to save it to sat (use api_save_entity_list).  There are two advantages to this suggestion: each piece of code is only doing one thing, and you have more information to debug with (sat files are human readable) see http://local.wasp.uwa.edu.au/~pbourke/dataformats/sat/sat.pdf for more information about that.

 

The request: please only post the message in one place, that way it is easier for everyone to see all the replies in one place.

 

Please let me know, with a sat file, if the code on the "Getting Started with the ACIS Faceter" page doesn't work for you.

 

thanks

 

Eric

Contributor
swapnalir
Posts: 9

Re: Mesh Api fails for some polygon boundary values

Thanks for the suggestions. And I m sorry for posting the same mail two different places.

 

I am still nt able to change the Triangle Edge length.

 

Can you Please explain me the relation between Polygon edge length and Max triangle length.

 

Thanks for the same.