Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Surface intersection


Recommended Posts

I need to find the intersection between two surfaces (resulting in a set of lines, arcs or splines), or between a surface and a line/spline/arc (resulting in a point). Is there a function in the API that would do that for me? Or a suggestion how to do it myself?

 

Thanks

Marko

Link to comment
Share on other sites

Oh, it isn't that bad....

 

Add this function prototype....

 

DllImpExp MC_BOOL surf_surf_intersect(

ent *surf_ent1, ent *surf_ent2,

MC_BOOL use_uvs,

p_2d input_uv1, p_2d input_uv2,

MC_BOOL do_multiples, MC_BOOL make_xyz, MC_BOOL make_nurbs,

short make_uv,

short *n_ents,

MC_BOOL *interrupted);

 

...and here's a quick description of the arguments

 

Inputs:

 

surf_ent1, surf_ent2 - ptrs to surface entities

 

use_uvs - Provide UV values on the 2 surfaces to start searching for intersections?

 

input_uv1, input_uv2 - it 'use_uvs' is TRUE, these are the UVs you want to use. Otherwise, they are not used

 

do_multiples - Look for more than one solution?

 

make_xyz - create the curve(s) at the intersection

 

make_nurbs - if 'make_xyz' is TRUE, make them as NURB curves (NB_ID), otherwise they'll be Parametric (S_ID).

 

make_uv - make 'Surface curve' entities (CONS_ID): 0 = none, 1 = on 1st surface, 2 = on 2nd surface, 3 = on both

 

Outputs:

 

n_ents - number of entities created

 

interrupted - did the user hit 'Esc'?

 

My recommendations...

 

use_uvs = FALSE

do_multiples = TRUE (unless you known there is only one)

make_xyz = TRUE

make_nurbs = TRUE

make_uv = 0

Link to comment
Share on other sites

Thanks Pete,

 

I am going to try it as soon as possible. I suppose the function stores the generated entities into the database. Any neat trick to figure out what newly created entities are? I have got a couple of ideas, none of them being to appealing.

 

Marko

Link to comment
Share on other sites

Markov,

 

I think this will do it for you...

 

 

// save off current end of database

DB_LIST_ENT_PTR old_db_end = db_end;

 

// do the intersection

surf_surf_intersect(...);

 

//get pointer to 1st new entity

DB_LIST_ENT_PTR found_ptr, d_ptr;

if(old_db_end == NULL)

d_ptr = db_start;

else

d_ptr = old_db_end->next;

 

// starting with that one, cycle through the database to look at all the new entities

ent e;

MC_BOOL succf = FALSE;

do

{

get_ent(&d_ptr, &found_ptr, &e, ALIVE_BIT, ALL_ENTITIES_MASK, &succf);

if(succf)

{

// do what you want with the new entity

:

:

}

} while(succf);

Link to comment
Share on other sites
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...