.NET

.NET

Reply
Active Member
Dollih
Posts: 10
Registered: ‎01-08-2002
Message 1 of 2 (116 Views)

Assign plotstyle to Attribute definition in block

116 Views, 1 Replies
11-21-2013 07:24 AM

Hi.

 

I am trying to assign a plotstyle to attribute while creating a block.
First I create the block, then I insert the Blockref, in that process I have errors assigining a plotstyle to the attribute.
(I have also tried to assign the plotstyle while creating the block and attribute with poor results.)

Here is my attempt to do this:

 

            For Each objId As ObjectId In blkTblR
                Dim obj As DBObject = objId.GetObject(OpenMode.ForRead)
                If TypeOf obj Is AttributeDefinition Then
                    Dim ad As AttributeDefinition = objId.GetObject(OpenMode.ForRead)
                    Dim ar As AttributeReference = New AttributeReference()
                    ar.SetAttributeFromBlock(ad, blkRef.BlockTransform)
                    ar.Position = ad.Position.TransformBy(blkRef.BlockTransform)

                    ar.PlotStyleName = "025"

                    blkRef.AttributeCollection.AppendAttribute(ar)
                    tr.AddNewlyCreatedDBObject(ar, True)
                End If
            Next

 

Best wishes,

 

 

Active Member
CallMeJames
Posts: 8
Registered: ‎11-21-2013
Message 2 of 2 (105 Views)

Re: Assign plotstyle to Attribute definition in block

11-21-2013 08:25 AM in reply to: Dollih
Without seeing the rest of the code and just off the top of my head, I don't see a transaction and you are only opening the attribute definition for read, not write.
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.