Author Topic: AEC Style From Object?  (Read 1958 times)

0 Members and 1 Guest are viewing this topic.

Hugh_Compton

  • Guest
AEC Style From Object?
« on: June 12, 2008, 10:19:38 AM »

This is for ACA / ADT / MEP / ABS.
I have hacked together the code below which adds a member to the Styles in a drawing. It works well. How can I alter the code so that I can pass an entity (or objectId from the entity) into the dictionary and return the memberstyle???  Or is there another way of finding an AEC object's style?

Public Sub test1()
Dim ed As Autodesk.AutoCAD.EditorInput.Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Using trans As Transaction = db.TransactionManager.StartTransaction()
'Dim id As ObjectId
Dim memberstyles As New DictionaryMemberStyle(db)
Try

ed.WriteMessage("" & Chr(10) & "Adding the Member style")
Dim MemberStyle As New MemberStyle()
MemberStyle.SetToStandard(db)
MemberStyle.SubSetDatabaseDefaults(db)
MemberStyle.Description = "fred style"
memberstyles.AddNewRecord("fred", MemberStyle)

trans.AddNewlyCreatedDBObject(MemberStyle, True)
trans.Commit()

Catch
End Try
End Using
End Sub