Closed coditect closed 2 months ago
I'm not satisfied with the way the Notes
getter on File3dm
returns a File3dmNotes
that stores a copy of the ONX_Model
's ON_3dmNotes
object instead of referencing the original. This can lead to unanticipated results in Python and JavaScript when trying to alter a model's notes. For example, the following does not work as one might expect:
myFile = File3dm.Read("/path/to/my/model.3dm")
myFile.Notes.Notes = "These are my new notes"
print(myFile.Notes.Notes) # does not print the new notes
Instead, one has to reassign the modified File3dmNotes
back to File3dm.Notes
:
theNotes = myFile.Notes
theNotes.Notes = "These are my new notes"
myFile.Notes = theNotes
print(myFile.Notes.Notes) # now it prints the new notes
This situation could be rectified by storing a reference or pointer to ON_3dmNotes
inside the File3dmNotes
class, but at the expense of added complexity. Since this problem occurs elsewhere in rhino3dm (LineCurve.Line
, for example), I wanted to get the input of @fraguada or @sbaer before introducing a new pattern into the library.
This pull request adds bindings for
File3dm.Notes
and theFile3dmNotes
class.