Prod.: Engine, ver.: 6022, ID: 60001617, Wish : Create associated hatches in different layers

Wish : Create associated hatches in different layers

Article60001617
TypeWish
ProductEngine
Version6022
Date Added2/1/2012
FixedYes [4/2/2012]
Submitted byAlex Vousvounis
Keywords

Subject

Create associated hatches in different layers

Summary

Is ti possible to create "associated" hatches in different layers than the layer of the "hatched" object ?

Solution

In version 6023 we added the ability to set to a polyhatch object that it is associative with a vdFigure. This can be very helpfull if you want to have a vdCircle in a layer1 and a polyhatch object in a layer2 and export them in DXF/DWG format as associative.
Following the below instructions the exported Polyhatch object will be associative with the figure object.

You add to the circle a vdXproperty with name "VDASSOCIATIVE" and as propvalue you set the vdPolyhatche's handle.
You add to the vdpolyhatch object an Xproperty with name "VDASSOCIATIVEHATCH" and as propvalue you set the figure's handle.

C# code example
vdDocument doc = vdFramedControl.BaseControl.ActiveDocument;
//In a Document we create a circle and a polyhatch object inside this circle.

//Select the two entities
bool test = doc.CommandAction.CmdSelect(null);
if (!test) return;
//Get the previous selection
vdSelection selset = doc.Selections.FindName ("VDRAW_PREVIOUS_SELSET");
if (selset == null || selset.Count == 0) return;

vdCircle circle = null;
vdPolyhatch hatch = null;
foreach (vdFigure item in selset)
{
if (item is vdCircle) circle = item as vdCircle;
else if (item is vdPolyhatch) hatch = item as vdPolyhatch;
}
if (circle == null || hatch == null) return;

//After getting these two entities we add the appropriete vdXproperties
vdXProperty xprop = hatch.XProperties.Add("VDASSOCIATIVEHATCH");
xprop.PropValue = circle.Handle.ToStringValue();
xprop = circle.XProperties.Add("VDASSOCIATIVE");
xprop.PropValue = hatch.Handle.ToStringValue();