.NET

Reply
*perry
Message 1 of 2 (62 Views)

Setting attribute prompt crashes acad

62 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;
*perry
Message 2 of 2 (62 Views)

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
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.