Problem with selecting objects in ViewPort3D
#1
[Hello! We are evaluating trial version of Ab3d.Powertoys and came across interesting problem. If we create our own custom GeometryModel3D object, and, lets say, 5 instances of the same object are added to ViewPort in different locations, and one of them is selected, all of them get highligted. On the other hand if create predifined GeometryModel3D object with Model3DFactory, add as many instances to the viewport as needed, and then select one of them, only selected object gets highlighted. Could anybody explain why is that so? Here is sample code:]
MeshGeometry3D extrudedMesh2 = Ab3d.Meshes.Mesh3DFactory.CreateExtrudedMeshGeometry(_pointList, isSmooth, modelOffset, extrudeVector);

int posX = 100;
int posY = 100;
for (int i = 0; i < 5; i++)
{
CreateGeometryModel(extrudedMesh, posX, posY);
posX += 100;
}
}


private void CreateGeometryModel(MeshGeometry3D meshGeometry3D, int X, int Z)
{
GeometryModel3D customModel = new GeometryModel3D(meshGeometry3D, new DiffuseMaterial(Brushes.Green));
ScaleTransform3D _scaleTransform = new ScaleTransform3D(0.2, 0.2, 0.2);
RotateTransform3D _rotateTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 0), 0), new Point3D(0, 0, 0));
TranslateTransform3D _translateTransform = new TranslateTransform3D(new Vector3D(X, 0, Z));

var transformGroup = new Transform3DGroup();
transformGroup.Children.Add(_scaleTransform);
transformGroup.Children.Add(_rotateTransform);
transformGroup.Children.Add(_translateTransform);

customModel.Transform = transformGroup;
ObjectsGroup.Children.Add(customModel);

GeometryModel3D predefinedModel = Ab3d.Models.Model3DFactory.CreateBox(new Point3D(0, 0, 0), new Size3D(40, 40, 40), _normalMaterial);
predefinedModel.Transform = transformGroup;

ObjectsGroup.Children.Add(predefinedModel);



Ab3d.Utilities.EventManager3D _eventManager3D;
_eventManager3D = new Ab3d.Utilities.EventManager3D(MainViewport3D);


var modelEventSource3D = new Ab3d.Utilities.ModelEventSource3D(customModel);
modelEventSource3D.MouseEnter += BoxOnMouseEnter;
modelEventSource3D.MouseLeave += BoxOnMouseLeave;
modelEventSource3D.MouseClick += BoxOnMouseClick;
_eventManager3D.RegisterEventSource3D(modelEventSource3D);

var modelEventSource3D2 = new Ab3d.Utilities.ModelEventSource3D(predefinedModel);
modelEventSource3D2.MouseEnter += BoxOnMouseEnter;
modelEventSource3D2.MouseLeave += BoxOnMouseLeave;
modelEventSource3D2.MouseClick += BoxOnMouseClick;
_eventManager3D.RegisterEventSource3D(modelEventSource3D2);

}
  


Messages In This Thread
Problem with selecting objects in ViewPort3D - by NPVoljers - 10-05-2015, 05:17 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)