Can anyone tell me why this does not work
Dim ObjIDs AsDatabaseServices.ObjectIdCollection
ObjIDs = NewDatabaseServices.ObjectIdCollection(myPSR.Value.GetObjectIds)
Dim myTransMan AsDatabaseServices.TransactionManager
Dim myTrans AsDatabaseServices.Transaction
myTransMan = myDWG.TransactionManager
myTrans = myTransMan.StartTransaction
ForEach ObjID As DatabaseServices.ObjectId InObjIDs
Dim myEntity AsDatabaseServices.Viewport
myEntity = ObjID.GetObject(DatabaseServices.OpenMode.ForWrite)
myEntity.UpgradeOpen()
myEntity.UpdateDisplay()
myEntity.RenderMode = 4
NextObjID
myTrans.Commit()
I can succesfully add myEntity.ViewHeight = 50
Thanks
Solved! Go to Solution.
Solved by Martin60. Go to Solution.
Hi Martin,
I am not sure this is the problem but I see that you do an ObjID.GetObject. You should really be doing myTrans.GetObject. I guess ObjID.GetObject does use the the top transaction but I am not sure. It is better to be explicit and use myTrans.GetObject.
Also try calling myEntity.UpdateDisplay() after setting the render mode.
Cheers
Gopinath Taget
Autodesk Developer Network
Thanks Gopinath.
This did not work for me but I thought I would try another method.
I discovered that RenderMode is not the property I needed and VisualStyleID is.
I have a function to get the objectID for the required Visual Style and all is well.
ForEach ObjID As DatabaseServices.ObjectId InObjIDs
Dim myEntity AsDatabaseServices.Viewport
myEntity = myTrans.GetObject(ObjID, DatabaseServices.OpenMode.ForWrite)
myEntity.UpgradeOpen()
myEntity.VisualStyleId = VisualStyleFuncs.VisualStyleObjID("3DWireFrame")
myEntity.UpdateDisplay()
Next ObjID