Start a new topic

Concave Polygons

Original Post by: Tue Dec 9 17:15:31 2014


is this the right way to select Concave faces?

static mgbool ccvfaces (mgrec* db, mgrec* parent, mgrec* rec, void* lgData)

{

toolrec* toolRec = (toolrec*)lgData;

if (mgGetCode(rec) == fltPolygon)

{

if (mgIsPolyConcave(rec));

{

mgSelectOne(rec);

}

}

return MG_TRUE;

}


Original Post by: SteveThompson Tue Dec 9 17:18:28 2014


Looks ok. Is this a trick question? :gulp:


The best way to know is to run the code. If it works then it's right ;-)

Original Post by: Tue Dec 9 17:23:56 2014


Looks ok. Is this a trick question? :gulp:


The best way to know is to run the code. If it works then it's right ;-)


I tried with that code now, but its selecting all the polygons.

Original Post by: SteveThompson Tue Dec 9 17:30:46 2014


oh I see the problem. You have a semicolon after the 2nd if condition. Remove that!


if (mgIsPolyConcave(rec));


should be:

if (mgIsPolyConcave(rec))


the way it's written now "nothing" happens if the polygon is concave (empty statement) and the next line ALWAYS happens (it's outside of the if).

Original Post by: Tue Dec 9 17:34:36 2014


Thank ypu so much...


This works fine..


static mgbool ccvfaces (mgrec* db, mgrec* parent, mgrec* rec, void* userData)

{

toolrec* toolRec = (toolrec*)userData;

if (mgGetCode(rec) == fltPolygon)

{

if (mgIsPolyConcave(rec))

{

mgSelectOne(rec);

}

}

return MG_TRUE;

}

Original Post by: SteveThompson Tue Dec 9 17:36:59 2014


Good...


Sorry to nag (and we are glad to help) but I would suggest you embrace the Visual Studio debugger. Using it you most likely would have found this on your own. Again, we're happy to help but we do want you to learn and progress and become more independent ;-)

Original Post by: Tue Dec 9 17:49:32 2014


Good...


Sorry to nag (and we are glad to help) but I would suggest you embrace the Visual Studio debugger. Using it you most likely would have found this on your own. Again, we're happy to help but we do want you to learn and progress and become more independent ;-)


My problem is I tried debugging but to be frank I don't know how it works... otherwise I would have skipped these silly questions up to a limit.

I have few questions on that .

1)When I hit debug will the plugin loaded automatically in creator when it opens up??

Original Post by: SteveThompson Tue Dec 9 18:06:37 2014


My problem is I tried debugging but to be frank I don’t know how it works… otherwise I would have skipped these silly questions up to a limit.

I have few questions on that .

1)When I hit debug will the plugin loaded automatically in creator when it opens up??


I assume you are building your plugin in Visual Studio. When you do this, you have to first tell Visual Studio what program to run when you debug. Your plugin is a DLL so VS won't know how to "run" that. You do this in the plugin project properties. In Configuration Properties > Debugging, set the Command to point to the Creator executable. Then, if you built your plugin in debug you should be able to set breaks and step through the code in your plugin.


This topic is a bit larger than we normally handle here on the forum (since there is tons of information on Visual Studio elsewhere) but hopefully we can get you pointed in the right direction.

Login to post a comment