For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

AIS Line selection on infinite line

Massimo Del Fedele's picture
Forums: 

I see that infinite lines are selected as long segments in selection manager; segments are
created to be 500 m (500'000 mm) long, which is not enough, IMHO :

//=======================================================================
//function : ComputeInfiniteLineSelection
//purpose :
//=======================================================================

void AIS_Line::ComputeInfiniteLineSelection(const Handle(SelectMgr_Selection)& aSelection)
{

/* // on calcule les points min max a partir desquels on cree un segment sensible...
GeomAdaptor_Curve curv(myComponent);
gp_Pnt P1,P2;
FindLimits(curv,myDrawer->MaximalParameterValue(),P1,P2);
*/
const gp_Dir& thedir = myComponent->Position().Direction();
const gp_Pnt& loc = myComponent->Position().Location();
const gp_XYZ& dir_xyz = thedir.XYZ();
const gp_XYZ& loc_xyz = loc.XYZ();
//POP Standard_Real aLength = UnitsAPI::CurrentToLS (250000. ,"LENGTH");
Standard_Real aLength = UnitsAPI::AnyToLS (250000. ,"mm"); gp_Pnt P1 = loc_xyz + aLength*dir_xyz;
gp_Pnt P2 = loc_xyz - aLength*dir_xyz;
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,5);
Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(eown,P1,P2);
aSelection->Add(seg);
}

I think that's not always enough; creating a drawing with default view sizes makes infinite lines partially
non-selectables. I'd suggest to increase the value by a factor 10 or more; I tested with
25'000'000 mm (50 KM total) and all works as before, just the lines are always selectable.

Besides selection, which is not so nasty if line can't be selected on some points, the problem is
when you use AIS Selection to snap to points, for example intersections; when lines are not selectable,
you can't neither snap on their points.

Max

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.