The probelm still exists 5 years later.
Here is a brute force workaround for VB.NET. I'm posting it only to help the novice who needs a quick way to get their VB.NET program working now without having to drop everything and study up on the subject.
This subroutine can be added to a module and called from your main program by:
DrawLinechgPSerase()
The code ctreates a line in model space, changes the line's plot style to one your program needs to use later, then erases the line. The program repeats for each plot style name listed in the array.
{code
' workaround reqd to get Acad PStable dictionary to "see" a previously unused plot style name
Public Sub DrawLinechgPSerase()
Dim validplotstylearray As Object
Dim i As Integer
Dim DBcur As Database = HostApplicationServices.WorkingDatabase
' Enter your problem Plot Style names here..
validplotstylearray = New Object() {"Normal", "StyleA", "StyleB", "StyleC"}
For i = 0 To UBound(validplotstylearray)
Dim myLine As New Line(Point3d.Origin, New Point3d(4, 5, 6))
Using myTrans As Transaction = DBcur.TransactionManager.StartTransaction
Dim myBT As BlockTable = DBcur.BlockTableId.GetObject(OpenMode.ForRead)
Dim myModelSpace As BlockTableRecord = myBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
myModelSpace.AppendEntity(myLine)
myLine.PlotStyleName = validplotstylearray(i)
myTrans.AddNewlyCreatedDBObject(myLine, True)
myTrans.Commit()
End Using
Using myTrans As Transaction = DBcur.TransactionManager.StartTransaction
Dim myBT As BlockTable = DBcur.BlockTableId.GetObject(OpenMode.ForRead)
Dim myModelSpace As BlockTableRecord = myBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
myLine.Erase()
myTrans.Commit()
End Using
Next
End Sub
code}
Can't find what you're looking for? Ask the community or share your knowledge.