.NET

Reply
*perry
Message 1 of 2 (58 Views)

Setting attribute prompt crashes acad

58 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 (58 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);
}

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community