Thank you for your email.
SetAttributeFromBlock() can't be called. If I call this function, attributes
will go to (0,0,0) position.
And also, if I set HorisontalMode of attribute, the attributes go to (0,0,0)
again.
attRef.HorizontalMode =
Autodesk.AutoCAD.DatabaseServices.TextHorizontalMode.TextCenter;
Zhongwei
"Tony Tanzillo" wrote in message
news:4968338@discussion.autodesk.com...
Most of the code from the example is not required if
you make the change I noted. For example, there
should be no need for manual translation, rotation,
and scaling since the BlockTransform matrix contains
all of that information, and SetAttributeFromBlock()
should do the transformation for you.
If I'm wrong about that, please let me know.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Zhongwei Xia" wrote in message
news:4968152@discussion.autodesk.com...
Hi, Tony,
Guess what!? I just comment the following line out, and set TextStyle from
AttributeDefinition. It works!!!.
// attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);
attRef.TextStyle = attDef.TextStyle;
Thank you very much. You emails help me alot.
Zhongwei
"Tony Tanzillo" wrote in message
news:4968102@discussion.autodesk.com...
Amazing.
The Matrix3d argument to SetAttributeFromBlock()
should be set to the value of the BlockTransform
property of the owning BlockReference object.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Zhongwei Xia" wrote in message
news:4967872@discussion.autodesk.com...
Hi, Tony,
Yes, it does. Thank you for your reply.
Zhongwei
"Tony Tanzillo" wrote in message
news:4967690@discussion.autodesk.com...
Does the sample code from ADN actually show a call
to SetAttributeFromBlock(), with Matrix3d.Identity as
the second parameter???
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
"Zhongwei Xia" wrote in message
news:4967475@discussion.autodesk.com...
Hello,
Has everyone tried to insert blocks with attributes into a drawing file by
using dotnet (C# or VB.NET)?
There is an example "How to insert block with attributes into a drawing
using VB.NET" from ADN web site. But unfortunately, it doesn't work. Anytime
the attributes are inserted on Original position no matter how Position
properties of the attributes are set.
Following is part of my code:
AttributeDefinition attDef = (AttributeDefinition)ent;
AttributeReference attRef = new AttributeReference();
attDef = (AttributeDefinition)ent;
attRef.SetAttributeFromBlock(attDef, Matrix3d.Identity);
Point3d ptBase = new Point3d(blkRef.Position.X + attDef.Position.X,
blkRef.Position.Y + attDef.Position.Y,
blkRef.Position.Z + attDef.Position.Z);
//attRef.Position = ptBase;
//attRef.Position = insPoint;
attRef.Position = new Point3d(50, 50, 50);
attRef.Rotation = attDef.Rotation;
attRef.Tag = attDef.Tag;
attRef.TextString = "Attribute Text";
attRef.Height = attDef.Height;
attRef.FieldLength = attDef.FieldLength;
Can anybody help? Thank you very much.
Zhongwei Xia