Archived issue #0025560
Documentation - describe changes in AIS_InteractiveConnect and AIS_MultipleConnected introduced within 6.8.0
Description
(Tracker per the respective post on the forum https://dev.opencascade.org/index.php?q=node/1019)
Version 6.8.0 apparently introduced some signficant change about how the IO's can be connected.
The former use case as explained in my blog post (http://opencascade.blogspot.ru/2013/11/ais-connecting-objects.html) has been broken.
In particular an exception is currently thrown in ConnectedInteractive:
void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
{...
else
{
Standard_ProgramError::Raise ("AIS_ConnectedInteractive::Connect() - object without own presentation can not be connected");
}
}
The change seems to be introduced in #25371 ([archived tracker link removed]), to which access is denied for
community members to get further details.
The use case as explained in the above blog post is to create a hierarchy of AIS_IO's via connection of CI and MC. Here is
an excerpt as pseudo-code:
Handle_AIS_InteractiveObject CreateIO (const SceneGraphElement& e)
{
Handle_AIS_InteractiveObject r;
if (e is a Part (i.e. leaf of scene graph)) {
r = create_concrete_interativeobject();
} else if (e is Instance) {
Handle_AIS_InteractiveObject ref_r = CreateIO (e->reference); //recursion
Handle_AIS_ConnectedInteractive i = new AIS_ConnectedInteractive;
i->Connect (ref_r, location);
r = i;
} else if (e is assembly) {
Handle_AIS_MultipleConnected m = new AIS_MultipleConnected;
for (all childs in assembly) {
Handle_AIS_InteractiveObject c = CreateIO (child_i); //recursion
m->Connect (c);
}
r = m;
}
return r;
}
Thus, there never exists a presentation for any IO which gets connected and any interim IO will ever be displayed itself.
Neither the Release Notes nor the Visualization User's Guide invalidate the formerly valid and working use case. So please do
restore the possibility existed before and meanwhile please advise on a proper work-around.
Version 6.8.0 apparently introduced some signficant change about how the IO's can be connected.
The former use case as explained in my blog post (http://opencascade.blogspot.ru/2013/11/ais-connecting-objects.html) has been broken.
In particular an exception is currently thrown in ConnectedInteractive:
void AIS_ConnectedInteractive::Connect (const Handle(AIS_InteractiveObject)& theAnotherObj)
{...
else
{
Standard_ProgramError::Raise ("AIS_ConnectedInteractive::Connect() - object without own presentation can not be connected");
}
}
The change seems to be introduced in #25371 ([archived tracker link removed]), to which access is denied for
community members to get further details.
The use case as explained in the above blog post is to create a hierarchy of AIS_IO's via connection of CI and MC. Here is
an excerpt as pseudo-code:
Handle_AIS_InteractiveObject CreateIO (const SceneGraphElement& e)
{
Handle_AIS_InteractiveObject r;
if (e is a Part (i.e. leaf of scene graph)) {
r = create_concrete_interativeobject();
} else if (e is Instance) {
Handle_AIS_InteractiveObject ref_r = CreateIO (e->reference); //recursion
Handle_AIS_ConnectedInteractive i = new AIS_ConnectedInteractive;
i->Connect (ref_r, location);
r = i;
} else if (e is assembly) {
Handle_AIS_MultipleConnected m = new AIS_MultipleConnected;
for (all childs in assembly) {
Handle_AIS_InteractiveObject c = CreateIO (child_i); //recursion
m->Connect (c);
}
r = m;
}
return r;
}
Thus, there never exists a presentation for any IO which gets connected and any interim IO will ever be displayed itself.
Neither the Release Notes nor the Visualization User's Guide invalidate the formerly valid and working use case. So please do
restore the possibility existed before and meanwhile please advise on a proper work-around.
Steps to reproduce
NA
Additional information
The only correction needed is related to Visualization User's Guide: it should be extended by a chapter describing the new design of connected interactive objects and the rules of their usage.
Public activity
21 archived notes
Participants are labeled by their role within this record.
Dear Roman,
could you please describe in more detail exactly the use case that is no more working for you? Probably simple draw command would be sufficient to address your problem.
From current description I can not find the statement that was not documented.
could you please describe in more detail exactly the use case that is no more working for you? Probably simple draw command would be sufficient to address your problem.
From current description I can not find the statement that was not documented.
Dear Kirill,
Please find the reproducer below, made with the help of shape structure.
Apparently the exception gets raised on the combination of ConnectedInteractive referring to the MultipleConnectedInteractive. The method ::Connect() checks HasOwnRepresentations() which is set to false for MC.
static Handle_AIS_InteractiveObject CreateAIS (const TopoDS_Shape& theShape)
{
Handle_AIS_InteractiveObject r;
if (theShape.IsNull ())
return r;
const TopLoc_Location& aLoc = theShape.Location ();
if (!aLoc.IsIdentity ()) { //instance
Handle_AIS_ConnectedInteractive aCon = new AIS_ConnectedInteractive;
TopoDS_Shape aRef = theShape.Located (TopLoc_Location ());
Handle_AIS_InteractiveObject aRefAIS = CreateAIS (aRef);
if (!aRefAIS.IsNull ()) {
aCon->Connect (aRefAIS, aLoc);
}
r = aCon;
} else if (theShape.ShapeType () == TopAbs_COMPOUND) { //assembly
Handle_AIS_MultipleConnectedInteractive aM = new AIS_MultipleConnectedInteractive;
for (TopoDS_Iterator i (theShape); i.More (); i.Next ()) {
Handle_AIS_InteractiveObject aChildAIS = CreateAIS (i.Value ());
if (!aChildAIS.IsNull ())
aM->Connect (aChildAIS);
}
r = aM;
} else { //part
r = new AIS_Shape (theShape);
}
return r;
}
static void Test ()
{
TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex (gp_Pnt (0., 0., 0.));
gp_Trsf aT;
aT.SetTranslation (gp_Vec (1, 2, 3));
TopoDS_Compound aC;
BRep_Builder aB;
aB.MakeCompound (aC);
aB.Add (aC, aV.Located (TopLoc_Location (aT)));
Handle_AIS_InteractiveObject anAIS = CreateAIS (aC.Located (aT));
}
Please find the reproducer below, made with the help of shape structure.
Apparently the exception gets raised on the combination of ConnectedInteractive referring to the MultipleConnectedInteractive. The method ::Connect() checks HasOwnRepresentations() which is set to false for MC.
static Handle_AIS_InteractiveObject CreateAIS (const TopoDS_Shape& theShape)
{
Handle_AIS_InteractiveObject r;
if (theShape.IsNull ())
return r;
const TopLoc_Location& aLoc = theShape.Location ();
if (!aLoc.IsIdentity ()) { //instance
Handle_AIS_ConnectedInteractive aCon = new AIS_ConnectedInteractive;
TopoDS_Shape aRef = theShape.Located (TopLoc_Location ());
Handle_AIS_InteractiveObject aRefAIS = CreateAIS (aRef);
if (!aRefAIS.IsNull ()) {
aCon->Connect (aRefAIS, aLoc);
}
r = aCon;
} else if (theShape.ShapeType () == TopAbs_COMPOUND) { //assembly
Handle_AIS_MultipleConnectedInteractive aM = new AIS_MultipleConnectedInteractive;
for (TopoDS_Iterator i (theShape); i.More (); i.Next ()) {
Handle_AIS_InteractiveObject aChildAIS = CreateAIS (i.Value ());
if (!aChildAIS.IsNull ())
aM->Connect (aChildAIS);
}
r = aM;
} else { //part
r = new AIS_Shape (theShape);
}
return r;
}
static void Test ()
{
TopoDS_Vertex aV = BRepBuilderAPI_MakeVertex (gp_Pnt (0., 0., 0.));
gp_Trsf aT;
aT.SetTranslation (gp_Vec (1, 2, 3));
TopoDS_Compound aC;
BRep_Builder aB;
aB.MakeCompound (aC);
aB.Add (aC, aV.Located (TopLoc_Location (aT)));
Handle_AIS_InteractiveObject anAIS = CreateAIS (aC.Located (aT));
}
Severity has been lowered since this is expected behavior change.
Dear Danila,
please update Visualization User's Guide as discussed on the forum.
please update Visualization User's Guide as discussed on the forum.
Dear YSN,
Can you please contact DUV and try to draft together the Visualization User's Guide section dedicated to connected interactive objects?
Can you please contact DUV and try to draft together the Visualization User's Guide section dedicated to connected interactive objects?
Please contact me for some general explanations first of all.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Thu Nov 3 13:06:24 2016 +0300
0025560: Regression on AIS_InteractiveConnect and AIS_MultipleConnected support in 6.8.0
New section about Connected Interactive Objects.
Proofreading of extended section about z-layers.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Thu Nov 3 13:06:24 2016 +0300
0025560: Regression on AIS_InteractiveConnect and AIS_MultipleConnected support in 6.8.0
New section about Connected Interactive Objects.
Proofreading of extended section about z-layers.
Dear DUV,
Could you please review the implementation of your new text in Visualization manual.
I'd suggest explaining what each example shows.
Could you please review the implementation of your new text in Visualization manual.
I'd suggest explaining what each example shows.
Dear YSN,
Please consider changes committed to branch.
Please consider changes committed to branch.
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: duv
Date: Tue Nov 8 17:28:39 2016 +0300
Review of connected interactive section
[revision removed]
Detailed log of new commits:
Author: duv
Date: Tue Nov 8 17:28:39 2016 +0300
Review of connected interactive section
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Wed Nov 9 13:51:43 2016 +0300
0025560: Regression on AIS_InteractiveConnect and AIS_MultipleConnected support in 6.8.0
New section about scene-graph hierarchy and instancing.
Proofreading of extended section about z-layers.
Removal of obsolete information.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Wed Nov 9 13:51:43 2016 +0300
0025560: Regression on AIS_InteractiveConnect and AIS_MultipleConnected support in 6.8.0
New section about scene-graph hierarchy and instancing.
Proofreading of extended section about z-layers.
Removal of obsolete information.
Please, review.
Branch CR25560_1 reviewed with the following remarks:
Why not simply say "...is done in a virtual function..."?
Is this statement relevant here? Anyway, instances do not "project the selection" as the selection algorithm is not based on 2D projections since 6.9.0 release.
The class name is AIS_MultipleConnectedInteractive - not AIS_MultiplyConnectedInteractive, please correct all occurrences.
+The calculation of selection primitives (or sensitive entities) is done by the intermediary of a virtual function
Why not simply say "...is done in a virtual function..."?
+* Instances project the selection (or to remove the hidden lines) based on the current view.
Is this statement relevant here? Anyway, instances do not "project the selection" as the selection algorithm is not based on 2D projections since 6.9.0 release.
+Classes *AIS_ConnectedInteractive* and *AIS_MultiplyConnectedInteractive* ... +*AIS_MultiplyConnectedInteractive* represents an assembly...
The class name is AIS_MultipleConnectedInteractive - not AIS_MultiplyConnectedInteractive, please correct all occurrences.
In addition to Sergey's remarks, I would say that usage of the term "scene graph" is incorrect and confusing here:
In fact, OCCT does not have a scene graph in its original wide-spread meaning. The use case described in section occt_visu_3_2_7 should be referenced as single object hierarchy.
Please, correct the following:
+Scene hierarchy can be controlled by the following API calls:
Object hierarchy ...
+The conception of instancing (scene-graph level instancing) is separated from hierarchy.
The conception of instancing operates object's hierarchy principles along with the following
+The assemblies are able to participate in a scene hierarchy and are intended
The assemblies are able to participate in object's hierarchy and are intended
It is also necessary to add that AIS_ConnectedInteractive copies sensitive entities of origin object for selection, unlike AIS_MultipleConnectedInteractive that re-uses origin's entities.
+@subsubsection occt_visu_3_2_7 Scene-graph hierarchy
In fact, OCCT does not have a scene graph in its original wide-spread meaning. The use case described in section occt_visu_3_2_7 should be referenced as single object hierarchy.
Please, correct the following:
+Scene hierarchy can be controlled by the following API calls:
Object hierarchy ...
+The conception of instancing (scene-graph level instancing) is separated from hierarchy.
The conception of instancing operates object's hierarchy principles along with the following
+The assemblies are able to participate in a scene hierarchy and are intended
The assemblies are able to participate in object's hierarchy and are intended
It is also necessary to add that AIS_ConnectedInteractive copies sensitive entities of origin object for selection, unlike AIS_MultipleConnectedInteractive that re-uses origin's entities.
Branch [archived branch] has been updated by Participant.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Wed Nov 16 13:05:29 2016 +0300
Remarks taken into account.
[revision removed]
Detailed log of new commits:
Author: ysn
Date: Wed Nov 16 13:05:29 2016 +0300
Remarks taken into account.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch CR25560_1 reviewed without remarks, please test the updated Visualization User's Guide.
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Branch [archived branch] has been rebased on the current master
Branch [archived branch] has been deleted by Commenter 3.
[revision removed]
[revision removed]
Branch [archived branch] has been deleted by Commenter 3.
[revision removed]
[revision removed]
Related records