Hi,everyone. I have trouble problem in my project. I hope you can give me some suggestion.
In my Model There many hole on the column. and Some hole is wrong, and I know where are the wrong holes in every column. and I must delete this holes, There are hundreds holes that should be deleted. I can stand to delete them one by one using mouse click. I can wite gha, and rhp and all the script. While I find no sdk,no slutions to this. Maybe I need crack the rhcommon_c.dll to see if any functions can be used to this. I also have read the opennurbs C code for how we create a brep. still, I find nothing to solve this. Help me, @dale @stevebaer @DavidRutten @mary
and below is the code I want to try release this by command line. but I failed,Because the script aways stoped after delete the first hole.God help me–
Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_Component.GH_InputParamManager)
' pManager.AddTextParameter("Guid", "Id", "将要被替换的犀牛物件" & vbCrLf & "(RhinoObjects that will be replaced)", GH_ParamAccess.item)
'Dim guidParam As New Param_Guid
pManager.AddParameter(New Param_Guid, "Guid", "Id", "要被删除孔的犀牛物件" & vbCrLf & "(RhinoObjects that will be Deleted holes)", GH_ParamAccess.item)
pManager.AddPointParameter("HolePoint", "P", "孔位置的点" & vbCrLf & "(Point nearby hole)", GH_ParamAccess.list)
pManager.AddBooleanParameter("Delete", "D", "如果是True则进行删除动作" & vbCrLf & "(If true Perform the Delete)", GH_ParamAccess.item, False)
End Sub
Protected Overrides Sub RegisterOutputParams(ByVal pManager As Kernel.GH_Component.GH_OutputParamManager)
pManager.AddTextParameter("Result", "RG", "结果列表" & vbCrLf & "(Result)", GH_ParamAccess.list)
End Sub
Protected Overrides Sub SolveInstance(ByVal DA As Kernel.IGH_DataAccess)
If Banner.astrict.showmessage Then Return
Dim Ids As Guid = Guid.Empty
'Dim Ids As String = String.Empty
Dim Holept As New List(Of Point3d)
Dim blDelete As Boolean = False
If Not DA.GetData(0, Ids) Then Return
If Not DA.GetDataList(1, Holept) Then Return
If Not DA.GetData(2, blDelete) Then Return
If Not blDelete Then
GoTo line1
Reslist.Add(Now & "_未替换!(Replace failed!)")
Else
Reslist.Clear()
' Grasshopper.Instances.ActiveCanvas.ModifiersEnabled = False
End If
' rt.AddRange(docobjlist.Select(Function(geoobj As RhinoObject) GH_Convert.ObjRefToGeometry(New ObjRef(geoobj.Id))))
'Private Checked(5) As Boolean, Namestr() As String = {"Point", "Curve", "Brep", "Mesh", "TextDot", "TextEntity"}
Try
Dim rh As RhinoDoc = Rhino.RhinoDoc.ActiveDoc
' Dim rhobj As RhinoObject = rh.Objects.Find(Ids)
' Dim rhobj As RhinoObject = rh.Objects.Find(New Guid(Ids))
' Dim bobj As BrepObject = CType(rhobj, BrepObject)
' RhinoApp.SendKeystrokes("Cancel", True)
' RhinoApp.SendKeystrokes("Cancel", True)
' bobj.Select(True)
' RhinoApp.RunScript("_SolidPtOn", False)
' Dim gobjs As GripObject() = bobj.GetGrips
' rh.Views.RedrawEnabled = False
' RhinoApp.RunScript("-_DeleteHole ", True)
For Each worldpt As Point3d In Holept
Dim rvi As RhinoViewport = rh.Views.ActiveView.ActiveViewport
' Dim cpt As Point2d = rvi.WorldToClient(worldpt)
' Dim spt As Drawing.Point = rvi.ClientToScreen(cpt)
'If grpobj.CurrentLocation.DistanceTo(Holept) < tolar Then
' grpobj.Select(True)
Dim pln As New Plane(worldpt, Vector3d.XAxis, Vector3d.YAxis)
rvi.SetConstructionPlane(pln)
' RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.SetToPlanView(worldpt, Vector3d.XAxis, Vector3d.YAxis, True)
' Dim tropt As New Point3d(Holept), trtpt As New Point3d(tpt)
' tropt.Transform(Transform.PlaneToPlane(Plane.WorldXY, CurrentPln))
' trtpt.Transform(Transform.PlaneToPlane(Plane.WorldXY, CurrentPln))
' Dim movestr As String = String.Format(" {0},{1},{2}", worldpt.X, worldpt.Y, worldpt.Z)
' RhinoApp.SendKeystrokes("0", True)
' RhinoApp.RunScript("-_DeleteHole 0", True)
' RhinoApp.SendKeystrokes("-_DeleteHole 0 Cancel", True)
RhinoApp.SendKeystrokes("-_Untrim 0 Cancel", True)
' Utilityfunction.Pause(5)
RhinoApp.SendKeystrokes("Cancel", True)
RhinoApp.SendKeystrokes("Cancel", True)
RhinoApp.SendKeystrokes("Enter", True)
RhinoApp.SendKeystrokes("Enter", True)
' MsgBox("dd")
' RhinoApp.RunScript("Enter", True)
' MsgBox("ddd")
' RhinoApp.RunScript("Cancel", True)
' MsgBox("dddd")
' RhinoApp.RunScript("0", True)
' RhinoApp.RunScript("Cancel", True)
' RhinoApp.SendKeystrokes("Cancel", True)
' RhinoApp.RunScript(movestr, True)
' grpobj.Select(False)
' End If
Next
' RhinoApp.RunScript("Enter", False)
' RhinoApp.SendKeystrokes("Cancel", True)
'' rh.Views.RedrawEnabled = True
Reslist.Add(Now & "_替换成功!(Replace Success!)")
Catch ex As Exception
Reslist.Add(Now & "_替换失败!(Replace failed!)" & vbCrLf & ex.Message)
End Try
' Grasshopper.Instances.ActiveCanvas.ModifiersEnabled = True
line1: DA.SetDataList(0, Reslist)
End Sub