Xref insertion units
Hello all,
I'm inserting Xrefs into my drawing using COM and/or BRXNet but I get confusing results regarding scaling.
Can anybody give a small explanation (or point one out for me) on:
ScaleX, ScaleY, ScaleZ, BlockUnit, Unit Factor, InsUnits , Insertin Units Default source/target and the fact that the attached drawing might be created from a mm.dwt (millimeters) while the main drawing is created from a m.dwt (meters)
Eventhough I specify XYZ scale factors 1,1,1 I get ScaleX = 0.001 etc. for the insert for example.
I realize people tend to grab what ever template to work from (mm, inch, m etc) , they all mean to enter World Coordinates (e.g. UTM meters) in Modelspace.
How do I get the Xref to scale the way I want ( = ignore intelligent scaling)?
Highly confusing.
TIA,
Arno van Eeuwen
0
Comments
-
Hi Arno
To insert an Xref at the correct scale, both the inserted drawing and the parent drawing need their INSUNITS setting to be defined correctly. Please read the topic 'Inserting Blocks' in the Bricscad Help under User Guide / Blocks, Attributes and External References. As a matter of fact inserting external blocks and inserting xrefs use the same procedure to calculate the correct scaling factor.0 -
Hi Louis,
there is a different behaviour between attaching Xrefs manually or by (in this case) BRXNET:
I have a drawing showing a harbour outline, but its INSUNITS = 4 = mm, saved on disc: harbour.dwg.
I open a meter.dwt so this one has INSUNITS = 6 = meters.
After manually Xref-ing the harbour with scales 1,1,1 @ (0,0) , the xref appears but shrunk by a factor 1000 as expected. The proprty grid shows scales 1,1,1.
If I attach the same drawing by BRXNET, BlockReference.Scalefactors = new Scale3d(1,1,1) then the Xref appears at true size ('unshrunk') but the scales in the property grid are 1000, 1000, 1000.
That's my confusion....
Arno van Eeuwen
0 -
Ok, for those interested:after a few emails with Bricscad Support we came to a solution, I think its worth sharing.The C# code below is just a snippet, I hope it explains enough.The solution is: weather you add an external DWG to the blocktable as block or xref, always read it into a temporary dataBase and obtain the INSUNITS.Store the INSUNITS in the blocktablerecord.Upon insertion of the block the scaling vector can be adjusted.On with the dotNet quest....Arno//loading the DWG
if (!blockTable.Has(blockName))
{
using (Database tempDb = new Database(false, true))
{
tempDb.ReadDwgFile(dwgFileName, FileShare.Read, true, string.Empty);
if (!asXref)
id = doc.Database.Insert(blockName, tempDb, false); //load the DWG as block
else
id = doc.Database.AttachXref(dwgFileName, blockName); // create Xreference
BlockTableRecord rec = trans.GetObject(id, OpenMode.ForWrite) as BlockTableRecord;
rec.Units = tempDb.Insunits; //<< here we store the INSUNITS from the DWG in the blocktablerecord</span>
rec.DowngradeOpen();
}//while inserting the blockreferenceBlockReference blockReference = new BlockReference(insPnt, blockTable[blockName]);
layoutBlock.AppendEntity(blockReference);
trans.AddNewlyCreatedDBObject(blockReference, true);
blockReference.ScaleFactors = scale3d * blockReference.UnitFactor; //<< here we can adjust the scale for the units of the block</span>On with the dotNet quest.....Arno van Eeuwen0
This discussion has been closed.