.NET

Reply

Setting attribute prompt crashes acad

63 Views, 1 Replies
05-08-2006 01:39 PM
I am converting some older Arx code over to .Net and hit
a snag when trying to define some attributes in a new block
def. I after alloting a new attribute definition, I can alter
pretty much any property, but the promp. As soon as I try to
set the prompt acad crashes. Have I missed something obvious
here?
Thanks, Perry

/code snippet---------------------------------------------
AttributeDefinition aLetter = new AttributeDefinition();
aLetter.LayerId = lId;
aLetter.TextStyle = db.Textstyle;// need better
aLetter.Height = dRevLetterHeight;
aLetter.Rotation = dRevLetterRotation;
aLetter.HorizontalMode = oRevLetterJustify;
if (oRevLetterJustify == TextHorizontalMode.TextLeft)
{
aLetter.Position = pRevLetterIp;
}
else
{
aLetter.AlignmentPoint = pRevLetterAlign;
aLetter.Position = pRevLetterIp;
}
aLetter.VerticalMode = TextVerticalMode.TextBase;
aLetter.Prompt = "Revision Letter"; //crashing here, why???
aLetter.Tag = "TB_REV_LETTER";
aLetter.Invisible = false;
aLetter.Verifiable = false;
aLetter.Preset = false;
aLetter.Constant = false;
aLetter.FieldLength = 25;

Re: Setting attribute prompt crashes acad

05-09-2006 08:32 AM in reply to: *perry
Still not sure why the above would not work.
I changed the code as follows and now acad is
happy. Must you supply arguments to the attributedefinition
constructor?

code snippet--------------------------------------------
//Create Attribute definitions for the new block
//Using "using" here cuz was getting complaints by acad for not calling dispose on the attdefs
ObjectId lId = Utilities.SetLayer("revisions"); // layer for the attributes
using (AttributeDefinition aLetter = new AttributeDefinition(zeroPos, "", "TB_REV_LETTER", "Revision letter", db.Textstyle))
{
aLetter.LayerId = lId;
aLetter.Height = dRevLetterHeight;
aLetter.Rotation = dRevLetterRotation;
aLetter.HorizontalMode = oRevLetterJustify;
if (oRevLetterJustify == TextHorizontalMode.TextLeft)
{
aLetter.Position = pRevLetterIp;
}
else
{
aLetter.AlignmentPoint = pRevLetterAlign;
aLetter.Position = pRevLetterIp;
}
aLetter.VerticalMode = TextVerticalMode.TextBase;
//Append the attributes
newBtr.AppendEntity(aLetter);
trans.AddNewlyCreatedDBObject(aLetter, true);
}
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!