.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ViewPort Render Setting

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Martin60
408 Views, 2 Replies

ViewPort Render Setting

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

2 REPLIES 2
Message 2 of 3
gopinath.taget
in reply to: Martin60

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

Message 3 of 3
Martin60
in reply to: gopinath.taget

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost