Article | 60001613 |
Type | Wish |
Product | Engine |
Version | 6021 |
Date Added | 1/27/2012 |
Fixed | Yes [1/29/2012] |
Submitted by | Shannon Davenport |
Keywords |
Is there a way to get the entities within a vdinsert using a window select ?
A new method GetTransformedSelectedObjects was added in vdLayout object
Syntax:
SelectedObjectArray GetTransformedSelectedObjects(Box SelectionViewBox);
description:
Gets a collection of SelectedObject type object that represents all the primitives figures that belongs to this layout and passing through a rectangle in current View Co-ordinate system.
param name : SelectionViewBox
A bounding box in current View Co-ordinate system.
Returns a collection of the Selected entities that passing through the input bounding box in the order from the last in the entities collection to the first.
A C# Example that print all the primitives figures of ActiveLayout that throws a view rectangle.
Box rc;
//prompt the user to pick a rectangle that will be used to select the entities.
doc.Prompt("Pick a rectangle for crossing window entities select");
StatusCode sc = doc.Model.ActionUtility.getUserRectViewCS(null, out rc);
doc.Prompt(null);
if ( sc == StatusCode.Success)
{
SelectedObjectArray obs = doc.ActiveLayout.GetTransformedSelectedObjects(rc);
//display the results into commandline
doc.Prompt(string.Format("\r\nNumber of Selected objects : {0}", obs.Count)); doc.Prompt(null);
foreach (SelectedObject item in obs)
{
//foreach selected object displays the object type and a matrix that tranforms the object into world Co-ordinate system.
doc.Prompt(string.Format("\r\n{0}, object2world matrix = {1}", item.SelectedEntity.Entity, item.SelectedEntity.ObjectToWorldMatrix)); doc.Prompt(null);
//dispalys the owners tree for the selected object from inner to outer.
string tabs = "\t";
foreach (TransformedFigure owner in item.Owners)
{
doc.Prompt(string.Format("\r\n{0}Owner: {1}, object2world matrix = {2}", tabs,owner.Entity, owner.ObjectToWorldMatrix)); doc.Prompt(null);
tabs += "\t";
}
}
}
Example vb6:
The following type libraries from vectordraw must be also imported:
VectorDraw.Geometry.tlb
VectorDraw.Render.tlb
VectorDraw.Serialize.tlb
VectorDraw.Professional.tlb
=============================================
Dim p1 As Variant
Dim p2 As Variant
p1 = VDraw1.Utility.GetPointScreen
p2 = VDraw1.Utility.GetCornerScreen(p1)
Dim gp1 As New gPoint
Dim gp2 As New gPoint
gp1.SetValue p1(0), p1(1), p1(2)
gp2.SetValue p2(0), p2(1), p2(2)
Dim box As New VectorDraw_Geometry.box
box.AddPoint gp1
box.AddPoint gp2
Dim layout As VectorDraw_Professional.vdLayout
Set layout = VDraw1.ActiveDocument.ActiveLayOut.WrapperObject
Dim ret As VectorDraw_Professional.SelectedObjectArray
Set ret = layout.GetTransformedSelectedObjects(box)
For i = 0 To ret.Count - 1
Debug.Print ret(i).ToString
Next