Thanks @dale for reply. It’s little bit confusing.
When I run CommitChanges after CommitViewportChanges it somehow negates all changes done in with the CommitViewportChanges. Also some changes are not implemented when I run these methods and changes must be made separately. For example locking of the detail.
The DetailView.IsProjectionLocked property is not a property on the detail view object’s viewport. Thus, calling DetailViewObject.CommitViewportChanges is not required.
import Rhino
import scriptcontext as sc
def test_lock_detail():
filter = Rhino.DocObjects.ObjectType.Detail
rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select detail to lock", False, filter)
if not objref or rc != Rhino.Commands.Result.Success:
return
detail_obj = objref.Object()
if isinstance(detail_obj, Rhino.DocObjects.DetailViewObject):
detail = detail_obj.DetailGeometry
if detail and not detail.IsProjectionLocked:
detail.IsProjectionLocked = True
detail_obj.CommitChanges()
sc.doc.Views.Redraw()
if __name__=="__main__":
test_lock_detail()