[brlcad-tracker] [ brlcad-Support Requests-2934286 ] mk_extrusion not working
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: SourceForge.net <no...@so...> - 2010-01-19 19:44:08
|
Support Requests item #2934286, was opened at 2010-01-18 13:33 Message generated for change (Comment added) made by brlcad You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=640803&aid=2934286&group_id=105292 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Geometry Editing Group: None Status: Pending Resolution: Fixed Priority: 5 Private: No Submitted By: Oscar (ocarretero) Assigned to: Sean Morrison (brlcad) Summary: mk_extrusion not working Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: Sean Morrison (brlcad) Date: 2010-01-19 19:44 Message: 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. ---------------------------------------------------------------------- Comment By: Sean Morrison (brlcad) Date: 2010-01-19 17:15 Message: 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. ---------------------------------------------------------------------- Comment By: Oscar (ocarretero) Date: 2010-01-19 16:27 Message: 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 ---------------------------------------------------------------------- Comment By: Sean Morrison (brlcad) Date: 2010-01-19 16:01 Message: Keeping this one, closing out 2934277 as duplicate ---------------------------------------------------------------------- Comment By: Sean Morrison (brlcad) Date: 2010-01-19 15:59 Message: Duplicate of 2934277. ---------------------------------------------------------------------- Comment By: Sean Morrison (brlcad) Date: 2010-01-19 15:58 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=640803&aid=2934286&group_id=105292 |