Set Style of ACA Objects

Set Style of ACA Objects

ChrisPicklesimer
Advocate Advocate
686 Views
3 Replies
Message 1 of 4

Set Style of ACA Objects

ChrisPicklesimer
Advocate
Advocate

With the help of code found in this NG, I have been able to import ACA styles from a library dwg.  Once the style has been imported I am not sure how set the style once I create various ACA objects.  For structural member and wall objects I have created, I see a StyleID property.  I am assuming that is how I set the style.  How do I get the StyleID of ACA styles within a dwg file?

 

Thanks.

 

Chris

0 Likes
687 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Public Shared Function GetWallStyleId(ByVal name As String) As ObjectId
            Dim db As Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase
            Dim wallStyleId As ObjectId = ObjectId.Null
            Using tr As Transaction = db.TransactionManager.StartTransaction()
                Dim wallStylesDict As New Autodesk.Aec.Arch.DatabaseServices.DictionaryWallStyle(db)
                If wallStylesDict.Has(name, tr) Then
                    wallStyleId = wallStylesDict.GetAt(name)
                End If
                tr.Commit()
            End Using
            Return wallStyleId
        End Function

 

0 Likes
Message 3 of 4

ChrisPicklesimer
Advocate
Advocate

Thanks for the quick reply.  That is exactly what I needed.

 

Chris

0 Likes
Message 4 of 4

Anonymous
Not applicable

I use MEP and not much of the arch styles

It was a function I used for panelstyles I modified it for wallstyles, I did not test it

so let me know if it does not work

0 Likes