tag:blogger.com,1999:blog-3285677929777490656.post109556329842477946..comments2023-10-31T13:16:01.375+03:00Comments on Open CASCADE notes: AIS. Connecting objects.Roman Lyginhttp://www.blogger.com/profile/18338419158437898791noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-3285677929777490656.post-87164679720482317042014-03-14T21:28:58.565+04:002014-03-14T21:28:58.565+04:00Great! Thanks for sharing Max.Great! Thanks for sharing Max.Roman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-44555497234286540122014-03-14T20:39:23.509+04:002014-03-14T20:39:23.509+04:00Hi Roman,
If you're interested in it, I imple...Hi Roman,<br /><br />If you're interested in it, I implemented the missing selection :<br /><br />//=======================================================================<br />//function : ComputeSelection<br />//purpose :<br />//=======================================================================<br />void AIS_MultiInteractive::ComputeSelection(const Handle(SelectMgr_Selection) &aSel, const Standard_Integer aMode)<br />{<br /> if (!(HasLocation() || HasConnection()))<br /> return;<br /><br /> aSel->Clear();<br /> <br /> for(int iRef = 1; iRef <= myReferences.Length(); iRef++)<br /> {<br /> Handle(AIS_InteractiveObject) myReference = myReferences(iRef);<br /> <br /> if (!myReference->HasSelection(aMode))<br /> myReference->UpdateSelection(aMode);<br /> <br /> const Handle(SelectMgr_Selection)& TheRefSel = myReference->Selection(aMode);<br /> <br /> Handle(SelectMgr_EntityOwner) OWN = new SelectMgr_EntityOwner(this);<br /> <br /> Handle(Select3D_SensitiveEntity) SE3D, SNew;<br /> <br /> if (TheRefSel->IsEmpty())<br /> myReference->UpdateSelection(aMode);<br /> <br /> for (TheRefSel->Init();TheRefSel->More();TheRefSel->Next())<br /> {<br /> SE3D = Handle(Select3D_SensitiveEntity)::DownCast(TheRefSel->Sensitive());<br /> <br /> if (!SE3D.IsNull())<br /> {<br /> // Get the copy of SE3D<br /> SNew = SE3D->GetConnected(myLocation);<br /> <br /> if (aMode == 0)<br /> {<br /> SNew->Set(OWN);<br /> // In case if SE3D caches some location-dependent data<br /> // that must be updated after setting OWN<br /> SNew->SetLocation(myLocation);<br /> }<br /> <br /> aSel->Add(SNew);<br /> }<br /> }<br /> }<br />}<br /><br />(I made another class instead of fiddling with OCC one, but it's just a copy of it with the function implemented).<br /><br />Ciao<br /><br />MaxMicioMaxhttps://www.blogger.com/profile/07916636280964256124noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-58141322980845099552014-03-14T19:39:26.158+04:002014-03-14T19:39:26.158+04:00Looking into OCC code, selection is simply not imp...Looking into OCC code, selection is simply not implemented for multiple connected interactives....<br />I'll try to cook one myselfMicioMaxhttps://www.blogger.com/profile/07916636280964256124noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-11514726452012453432014-03-14T18:29:14.569+04:002014-03-14T18:29:14.569+04:00Hi Roman,
I'm still on it... by now no select...Hi Roman,<br /><br />I'm still on it... by now no selection for it, and some other glitches when used with shapes.<br />I use a custom build system, so no DRAW to test commands, just my application.<br />BTW, if you like to look at a screenshot of it just look here :<br />http://www.ultimatepp.org/forum/index.php?t=msg&&th=6218&goto=42379#msg_42379<br />It's starting to be an usable 3d cad.MicioMaxhttps://www.blogger.com/profile/07916636280964256124noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-50903529590995102872014-03-14T18:05:59.324+04:002014-03-14T18:05:59.324+04:00Hi MicioMax,
Glad you've figured it out. Regar...Hi MicioMax,<br />Glad you've figured it out. Regarding selection you might want to try in DRAW (see the commands above). If that is reproducible (and AFAIR there were some glitches indeed) you might want to file a bug in Mantis. <br />CAD Exchanger currently does not provide selection so I have not been affected by that (yet).<br />Would be good to learn what you end up with.<br />Good luck!<br />RomanRoman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-81033468920727668902014-03-14T18:01:12.144+04:002014-03-14T18:01:12.144+04:00Hi Roman,
you're right, I solved it just befo...Hi Roman,<br /><br />you're right, I solved it just before rading your comment ;-)<br />I tried to set object transformation and not location, and it didn't work.<br />Now it's all ok, besides selection.... the object don't get highlighted by mouse as it should be.MicioMaxhttps://www.blogger.com/profile/07916636280964256124noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-33392128441964095112014-03-14T14:51:41.230+04:002014-03-14T14:51:41.230+04:00Hello !
Not sure if I follow the expressed concer...Hello !<br /><br />Not sure if I follow the expressed concerns.<br />You should be able to create connected interactive objects *before* they ever get computed/displayed in the context.<br />Perhaps the following excerpt would be helpful (and address the prior requests which went unaddressed so far)<br /><br />For AIS_ConnectedInteractive :<br /><br />/*! Combines transformations attached to \a theAncestors. If no transformations are attached<br /> then returns \a theObject, ortherwise - AIS_ConnectedInteractive.<br />*/<br />static Handle_AIS_InteractiveObject Transform (<br /> const Handle_AIS_InteractiveObject& theObject,<br /> const ModelPrs_InteractiveObjectFactoryHelper::ObjectCollectionType& theAncestors)<br />{<br /> if (theObject.IsNull())<br /> return theObject; //AIS_ConnectedInteractive not always checks that it is not null<br /> TopLoc_Location aLoc;<br /> ModelPrs_InteractiveObjectFactoryHelper::CombineTransformations (theAncestors, aLoc);<br /> if (aLoc.IsIdentity())<br /> return theObject;<br /> Handle_AIS_ConnectedInteractive r = new AIS_ConnectedInteractive;<br /> r->Connect (theObject, aLoc);<br /> return r;<br />}<br /><br />For AIS_MultipleConnected:<br /><br />void RepresentationVisitor::Append (const Handle_AIS_InteractiveObject& theObject)<br />{<br /> if (myResult.IsNull())<br /> myResult = theObject;<br /> else {<br /> if (myResult->IsKind (STANDARD_TYPE (AIS_MultipleConnectedInteractive))) {<br /> __CADEX_DEFINE_HANDLE_BY_STATIC_CAST(AIS_MultipleConnectedInteractive, aM, myResult);<br /> aM->Connect (theObject);<br /> } else {<br /> Handle_AIS_MultipleConnectedInteractive aM = new AIS_MultipleConnectedInteractive;<br /> aM->Connect (myResult);<br /> aM->Connect (theObject);<br /> myResult = aM;<br /> }<br /> }<br />}<br /><br />In the above examples theObject has never been displayed yet, it has just been created on the fly.<br /><br />Also you can query the location using API of PrsMgr_PresentableObject which is a superclass of AIS_InteractiveObject:<br />- HasLocation()<br />- Location()<br /><br />Hope this helps. Good luck!<br />RomanRoman Lyginhttps://www.blogger.com/profile/18338419158437898791noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-54441860326050249452014-03-14T11:40:10.204+04:002014-03-14T11:40:10.204+04:00Probably I'm doing something wrong, but I find...Probably I'm doing something wrong, but I find it quite useless as it is.<br />I'm trying to use it do display a sort of "block" object (same as autocad's block entity, to clarify).<br />Block entity provides the single interactive objects on request and join them to a multiple connected one.<br />The 'insert' object queries block for multiple connected interactive, apply a transformation and displays it.<br />It should be all ok, but.... interactive objects DON'T store the transformation, they just apply it to presentation, and only when object is already displayed.<br />So, gahering the object, apply the transform and then display it simply don't work, the object appears as non-transformed.<br />I will probably try changing my code path, so displaying before and then apply the transform, but it makes it cumbersome and will require to review all my code just to be able to display correctly this object.....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-35902027381717001602013-12-09T11:50:43.567+04:002013-12-09T11:50:43.567+04:00Hi Roman!
can you please provide the full code of ...Hi Roman!<br />can you please provide the full code of this simple application?<br /><br />thanksMichelehttps://www.blogger.com/profile/03097858568358039396noreply@blogger.comtag:blogger.com,1999:blog-3285677929777490656.post-38024435801748816322013-11-14T19:55:04.311+04:002013-11-14T19:55:04.311+04:00Roman!
Can you give a sample of code. For instance...Roman!<br />Can you give a sample of code. For instance: there is a box and on the top two another boxes connected with first. When I move (translate) the bottom box, all three boxes should move together.Anonymousnoreply@blogger.com