Article | 60000970 |
Type | HowTo |
Product | Engine |
Version | 6 |
Date Added | 10/2/2009 |
Submitted by | Steve Howarth |
Keywords |
You can do this by setting to invisible the vdInserts of the XRef files (which are vsBlocks). Please check the code below:
(in an empty project add a vdFramed control and a button to open the drawing)
using
System;namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
vdFramedControl1.BaseControl.ActiveDocument.Open(@"C:\321\xref\master.vdml");
}
private void Form1_Load(object sender, EventArgs e)
{
vdFramedControl1.BaseControl.ActiveDocument.OnAfterOpenDocument += new VectorDraw.Professional.vdObjects.vdDocument.AfterOpenDocument(ActiveDocument_OnAfterOpenDocument);
}
void ActiveDocument_OnAfterOpenDocument(object sender)
{
VectorDraw.Professional.vdObjects.vdDocument doc = (VectorDraw.Professional.vdObjects.vdDocument)sender;
if (doc == null) return; //something gone bad ?!?!
if (doc.TopMostDocumet != doc) return; //do not run the code below for the xrefs but only for the "Master" drawing
//Create a selection
VectorDraw.Professional.vdCollections.vdSelection selset = new VectorDraw.Professional.vdCollections.vdSelection("Myselset");
selset.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument);
//Create a filter
VectorDraw.Professional.vdObjects.vdFilterObject filter = new VectorDraw.Professional.vdObjects.vdFilterObject();
//Add vdInsert to select all polylines
filter.Types.AddItem("vdInsert");
//Apply the filter. After this the selection will contain the selected polylines.
selset.FilterSelect(filter);
foreach (VectorDraw.Professional.vdFigures.vdInsert ins in selset)
{
if ((ins.Block.ExternalReference.FileName == @"C:\321\xref\circle1.vdml") || (ins.Block.ExternalReference.FileName == @"C:\321\xref\rect1.vdml")) // here check what xrefs you don't want to show
{
ins.visibility = VectorDraw.Professional.vdPrimaries.vdFigure.VisibilityEnum.Invisible;// here "set to invisible the xrefs"
ins.Update();
}
}
}
}
}