.NET

.NET

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

Assign plotstyle to Attribute definition in block

110 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 (99 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.
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 or visit the Installation and Licensing Forum to get help installing your software.