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

Setting IsMirroredInY from AttributeRefference

9 REPLIES 9
Reply
Message 1 of 10
marco
345 Views, 9 Replies

Setting IsMirroredInY from AttributeRefference

Hello,

I'm currently reprogramming a VBA Application into VB.Net. In VBA I used .UpsideDown an .Backward on an Attribute.

In .Net I have the property IsMirroredInY, but the behavior is not similar. In VBA a virtual line through the referencepoint is used by AutoCAD to mirror the text. But in VB.Net the baseline is used to mirror the AttributeReference verticaly thus making my text display in the wrong place because the text-justification I used in the blocks is Middle-Centre.

The behaviour of IsMirroredInX is the same as .Backward in VBA using the referencepoint defined in the AttributeDefinition.

Can I adjust the behaviour of IsMirroredInY or is it a bug in AutoCAD?
9 REPLIES 9
Message 2 of 10
jerrywinters
in reply to: marco

1. You are defining a block in .NET. Is that correct?
2. When you define the block and insert it, then mirror the Block Reference, the Attribute does not behave as you would expect. Correct?

Can you post a sample drawing file that shows this?

Jerry
Message 3 of 10
marco
in reply to: marco

I attached one of the dynamic blocks I'm using. The purpose of the code is to insert the dynamic blocks, set the visibility, set the length (Lengte) etc. and make the attributetext appear readable from bottom-right.
The code shows the use of IsMirroredY and IsMirroredX.
In the rest of the code TekstFlip is set to 1 to let the attribute flip to the other side of the beam. I'll post another reply with a screenshot of what's happening.

{code}
If BlockDef.HasAttributeDefinitions Then
Dim AtDef As adskDS.AttributeDefinition, AttRef As adskDS.AttributeReference
For Each SubEntId As adskDS.ObjectId In BlockDef
If SubEntId.ObjectClass.Name = "AcDbAttributeDefinition" Then
AtDef = trans.GetObject(SubEntId, adskDS.OpenMode.ForRead, False, True)
AttRef = New adskDS.AttributeReference
AttRef.SetAttributeFromBlock(AtDef, blockRef.BlockTransform)
If UCase(Left(AttRef.Tag, 5)) = "TEKST" Then
AttRef.TextString = CInt(Length / 10).ToString
'If Tekstflip is used then also flip attribute

If angle > 0.5 * System.Math.PI And angle <= 1.5 * System.Math.PI Then
AttRef.IsMirroredInX = True
AttRef.IsMirroredInY = True
End If
End If
blockRef.AttributeCollection.AppendAttribute(AttRef)
trans.AddNewlyCreatedDBObject(AttRef, True)
AtDef.Dispose()
AttRef.Dispose()
End If
Next
End If
{code}
Message 4 of 10
marco
in reply to: marco

In the screenshot you can see what's happening:
The IsMirroredInX uses the insertionpoint of the attribute to mirror the attributereference, but the IsMirroredInY uses the baseline. Therefore the attribute doesn't show up in the expected place (above the beam)
Take into account that first the attribute is mirrored and after that the flip is done.
Message 5 of 10
jerrywinters
in reply to: marco

If I setup a GoToMeeting, are you able to join it?

Jerry
Message 6 of 10
marco
in reply to: marco

I don't know. I never used it.
Message 7 of 10
Anonymous
in reply to: marco

After inserting one of your blocks, I can change the IsMirroredInX and
IsMirroredInY properties of the attribute and I see the exact same behavior
that I see when I use the Properties Palette to change the Backwards and
UpsideDown ActiveX properties (to select the attribute in the PropertyGrid
hold down the shift key and click on it).

I suspect the problem you're having is because the attribute calculates its
position when you commit your changes. In ActiveX, each property that's
changed will cause the object to be opened and closed, which triggers an
update. In ObjectARX, all properties you change are changed while the object
is open, and hence, no update occurs until the object is closed, and the
attribute does not recompute its geometry until you close it.

Try adding the attribute and closing it (which causes it to update). Then
reopen it and set the mirroring properties and see if that makes a
difference.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6290544@discussion.autodesk.com...
In the screenshot you can see what's happening:
The IsMirroredInX uses the insertionpoint of the attribute to mirror the
attributereference, but the IsMirroredInY uses the baseline. Therefore the
attribute doesn't show up in the expected place (above the beam)
Take into account that first the attribute is mirrored and after that the
flip is done.
Message 8 of 10
marco
in reply to: marco

I had a little problems to add the inbetween commit, but your suspect was true.
Thank you.
Message 9 of 10
Anonymous
in reply to: marco

I didn't notice this before, but the AttributeReference class inherits
the AdjustAlignment() method from DBText.

That might be a way to get it to recompute the text position
without requiring it to be opened and closed.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6290673@discussion.autodesk.com...
I had a little problems to add the inbetween commit, but your suspect was
true.
Thank you.
Message 10 of 10
marco
in reply to: marco

Hello Tony,

The AdjustAlignment method makes it happen and the code a lot more compact. Do you know what the use is of supplying the AlternateDatabaseToUse in the AdjustAlignment method?

Marco

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