.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting attribute prompt crashes acad

1 REPLY 1
Reply
Message 1 of 2
Anonymous
202 Views, 1 Reply

Setting attribute prompt crashes acad

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;
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost