Hi,
I’m trying to add a textDot to a bloc with the command ModifyGeometry() but it does not work:
Dim MyTextDot As New Rhino.Geometry.TextDot("MyText", MyLocation)
geometry.Add(MyTextDot)
attributes.Add(attr)
doc.InstanceDefinitions.ModifyGeometry(MyBlockInstDef.Index, geometry, attributes)
What’s strange is that it’s working fine if I do the exact same thing with a point:
Dim MyGPoint As New Point(MyLocation)
geometry.Add(MyGPoint)
attributes.Add(attr)
doc.InstanceDefinitions.ModifyGeometry(MyBlockInstDef.Index, geometry, attributes)
Hi @Dale, this is exactly what I’m doing in VB.net but it only works with a point and not with a textdot as described above. :’(
(By the way, it’s out of topic but it would have been way nicer to just have an Objects() Property for InstanceDefinitions instead of this weird .ModifyGeometry function)
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
Dim idefName As String = Nothing
Dim rc = RhinoGet.GetString("Name of block to modify", False, idefName)
If (rc <> Result.Success) Then
Return rc
End If
Dim idef As InstanceDefinition = doc.InstanceDefinitions.Find(idefName, True)
If idef Is Nothing Then
RhinoApp.WriteLine("Instance definition not found")
Return Result.Failure
End If
Dim objects As RhinoObject() = idef.GetObjects()
Dim geometry As New List(Of Rhino.Geometry.GeometryBase)
Dim attributes as New List(Of ObjectAttributes)
For each obj as RhinoObject in objects
geometry.Add(obj.Geometry)
attributes.Add(obj.Attributes)
Next
Dim origin As Point3d = Point3d.Origin
Dim dot as New TextDot(idef.Name, origin)
geometry.Add(dot)
attributes.Add(doc.CreateDefaultAttributes())
doc.InstanceDefinitions.ModifyGeometry(idef.Index, geometry, attributes)
doc.Views.Redraw()
Return Result.Success
End Function
Hi Dale,
This is what I did in vb.net but it does not work. However I changed my project design and I don’t need this anymore. Thanks a lot for your help.
Regards
Matthieu