#47 mk_extrusion not working

closed-fixed
5
2010-02-03
2010-01-18
Oscar
No

Hello,
I'm triing to write an external program that uses the CSG capabilities of BRL-cad. In fact, I want to fill a db with some objects, do boolean operations with them, do the triangulation, and get the triangles. I'm beginning with some tests, and I use the db_walk_tree sample from brl-cad.
When I add a box and a sphere (or a cone, or a cilinder), it works really fine. I get the triangles and the resulting mesh object is ok. Then I try to do an extrusion from an sketch. It's a very simple sketch with 5 points. But the program seems to hang for a while and then crashes...
I've revised everything in my code and i dont see anything wrong.
Can someone tell me what i'm doing wrong? I'm missing anything?
This is the part of the code where i add the extrusion:

int index;
struct rt_sketch_internal *skt;
vect_t u, V, h;
point2d_t lpt[5];
int i,a;

BU_GETSTRUCT(skt, rt_sketch_internal);
VSET( skt->u_vec, 1.0, 0.0, 0.0 );
VSET( skt->v_vec, 0.0, 1.0, 0.0 );
VSET( skt->V, 75.0, 75.0, 75.0 );
skt->magic = RT_SKETCH_INTERNAL_MAGIC;
skt->vert_count = 5;
skt->verts = bu_calloc( skt->vert_count, sizeof(point2d_t), "2d points" );

lpt[0][X] = 0;
lpt[0][Y] = 0;
lpt[1][X] = 0;
lpt[1][Y] = 75;
lpt[2][X] = 75;
lpt[2][Y] = 75;
lpt[3][X] = 75;
lpt[3][Y] = 0;
lpt[4][X] = 0;
lpt[4][Y] = 0;

for ( index=0; index < 5; index++ )
{
V2MOVE(skt->verts[index], lpt[index]);
}

mk_sketch( wdbp, "skt.s", skt);

VSET( u, 1.0, 0.0, 0.0 );
VSET( v, 0.0, 1.0, 0.0 );
VSET( V, 75.0, 75.0, 75.0 );
VSET( h, 0.0, 0.0, 100.0 );
mk_extrusion(wdbp, "extr.s", "skt.s", V, h, u, v,0);

I apologise for my bad programming skills and for my worst english...
Thanks,
Oscar

Discussion

  • Oscar

    Oscar - 2010-01-18
    • status: open --> wont-fix
     
  • Sean Morrison

    Sean Morrison - 2010-01-19

    Deleted because you figured out the bug?

    What you are attempting to do is something easily supported so you should be able to achieve your goal without too much trouble. If you do encounter a bug or question, please do make additional reports.

     
  • Sean Morrison

    Sean Morrison - 2010-01-19

    Duplicate of 2934277.

     
  • Sean Morrison

    Sean Morrison - 2010-01-19
    • assigned_to: nobody --> brlcad
    • status: wont-fix --> wont-fix-duplicate
     
  • Sean Morrison

    Sean Morrison - 2010-01-19
    • status: wont-fix-duplicate --> wont-fix
     
  • Sean Morrison

    Sean Morrison - 2010-01-19

    Keeping this one, closing out 2934277 as duplicate

     
  • Sean Morrison

    Sean Morrison - 2010-01-19
    • status: wont-fix --> pending-fixed
     
  • Oscar

    Oscar - 2010-01-19

    i think the problem was the first and last point were the same, (0,0). Changed last point to be (10,10) and it worked. So I supose I dont have to close the extrusions.
    Thanks,
    Oscar

     
  • Oscar

    Oscar - 2010-01-19
    • status: pending-fixed --> open-fixed
     
  • Sean Morrison

    Sean Morrison - 2010-01-19

    That is correct -- you don't need to repeat the last point. This is because sketch objects must define a closed loop in order for the extrusion to be valid. It certainly shouldn't crash with a repeated end-point, though, so that is certainly something to look into. If you could provide a debugger backtrace on the crash, that could prove helpful.

    Glad to hear you got it working though.

     
  • Sean Morrison

    Sean Morrison - 2010-01-19
    • status: open-fixed --> pending-fixed
     
  • Sean Morrison

    Sean Morrison - 2010-01-19

    Looking a bit closer at your code snippet, I notice that you don't actually define any curves. Is there a portion of your code that is missing?

    Otherwise, that is a problem. The verts array is literally just a set of 2d vertices. From those, you construct curve segments which can be simple straight line segments, bezier curves, arcs, etc. The skt_curve element of an rt_sketch_internal is what needs to have a loop defined.

     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks