DesignCAD User Forum

DesignCAD SDK => SDK Feature Requests => Topic started by: PaulO on May 31, 2017, 11:55:49 PM

Title: >PolygonSelection can't be sticky
Post by: PaulO on May 31, 2017, 11:55:49 PM
Hello everyone,

for one of my macros I need to be able to select entities using a selection box at an arbitrary angle...  ::)  I was thinking about this for a long time, because >DragSelect obviously can't just be rotated.

The solution I came up with works for about half the cases I need the angled selection box. Basically, I'm using a series of complicated SIN() and COS() calculations after a quick >AngleDistance to calculate the four corner points of the angled selection box, then I run >PolygonSelection and pass it the four corner points.

This works fine if I want to get a similar behaviour to "Type 0" of >DragSelect, which only selects entities which are inside the selection box entirely. But if I want to select any entity touching the angled selection box, >PolygonSelection leaves me hanging.

Currently I don't see an easy way around this, but it could easily be fixed if the >PolygonSelection command offered you these "Types" of different selections as well, with one type being "select only items inside or touched by box".

Cheers
Paul
Title: Re: >PolygonSelection can't be sticky
Post by: Rob S on June 01, 2017, 07:36:44 AM
You could consider temporarily rotating your entire drawing, and then using a normal selection box?
Title: Re: >PolygonSelection can't be sticky
Post by: DrollTroll on June 01, 2017, 10:14:53 AM
Maybe use SetWorkingPlane to temporarily rotate the coordinate axes, and then use dragselect? Calculating the new position of the bounding box would then require some mathematics, but it sounds like you're up to it. Then use ResetWorkingPlane when you're done.