示例#1
0
    def renameObject(self):
        wk = self.workGroup
        # ... renaming a geometry
        geo = wk.inspector.currentGeometry
        geoItem = wk.inspector.currentGeometryItem
        if geo is not None:
            from customDialogs import edtTxtDialog

            dlg = edtTxtDialog(None, title="Rename Geometry", size=(200, 75))
            dlg.ShowModal()
            ls_text = dlg.getValue()
            try:
                name = str(ls_text)
            except:
                name = None
            dlg.Destroy()
            if name is not None:
                geo.set_attribut("name", name)
            wk.inspector.tree.update()
            wk.inspector.reset_currentAll()
        # ... renaming a patch
        patch = wk.inspector.currentPatch
        patchItem = wk.inspector.currentPatchItem
        if patch is not None:
            geoItem = wk.inspector.tree.GetItemParent(patchItem)
            geo = wk.inspector.tree.GetPyData(geoItem)
            patch_id = geo.index(patch)
            patchInfo = geo.list_patchInfo[patch_id]

            from customDialogs import edtTxtDialog

            dlg = edtTxtDialog(None, title="Rename Patch", size=(200, 75))
            dlg.ShowModal()
            ls_text = dlg.getValue()
            try:
                name = str(ls_text)
            except:
                name = None
            dlg.Destroy()
            if name is not None:
                patchInfo.set_name(name)
            wk.inspector.tree.update()
            wk.inspector.reset_currentAll()
示例#2
0
    def renameObject(self):
        wk = self.workGroup
        # ... renaming a geometry
        geo = wk.inspector.currentGeometry
        geoItem = wk.inspector.currentGeometryItem
        if geo is not None:
            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Rename Geometry", size=(200, 75))
            dlg.ShowModal()
            ls_text = dlg.getValue()
            try:
                name = str(ls_text)
            except:
                name = None
            dlg.Destroy()
            if name is not None:
                geo.set_attribut("name", name)
            wk.inspector.tree.update()
            wk.inspector.reset_currentAll()
        # ... renaming a patch
        patch = wk.inspector.currentPatch
        patchItem = wk.inspector.currentPatchItem
        if patch is not None:
            geoItem = wk.inspector.tree.GetItemParent(patchItem)
            geo = wk.inspector.tree.GetItemData(geoItem)
            patch_id = geo.index(patch)
            patchInfo = geo.list_patchInfo[patch_id]

            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Rename Patch", size=(200, 75))
            dlg.ShowModal()
            ls_text = dlg.getValue()
            try:
                name = str(ls_text)
            except:
                name = None
            dlg.Destroy()
            if name is not None:
                patchInfo.set_name(name)
            wk.inspector.tree.update()
            wk.inspector.reset_currentAll()
示例#3
0
    def OnCoons(self, event):
        wk = self.parent.tree.currentWorkGroup
        if wk is None:
            return

        if event.GetId() == self.CoonsTolID:
            tol = wk.preferences.coons["tol"]

            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Edit Tolerance", size=(200, 75))
            dlg.setValue(str(tol))
            dlg.ShowModal()
            try:
                value = float(dlg.getValue())
            except:
                value = tol
            wk.preferences.set_coons("tol", value)
            dlg.Destroy()
示例#4
0
    def OnIntersection(self, event):
        wk = self.parent.tree.currentWorkGroup
        if wk is None:
            return

        if event.GetId() == self.IntersectionNptsID:
            npts = wk.preferences.intersection["npts"]

            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Edit Resolution", size=(200, 75))
            dlg.setValue(str(npts))
            dlg.ShowModal()
            try:
                value = int(dlg.getValue())
            except:
                value = npts
            wk.preferences.set_intersection("npts", value)
            dlg.Destroy()
示例#5
0
    def OnCoons(self, event):
        wk = self.parent.tree.currentWorkGroup
        if wk is None:
            return

        if event.GetId() == self.CoonsTolID:
            tol = wk.preferences.coons["tol"]

            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Edit Tolerance", size=(200,75) )
            dlg.setValue(str(tol))
            dlg.ShowModal()
            try:
                value = float(dlg.getValue())
            except:
                value = tol
            wk.preferences.set_coons("tol", value)
            dlg.Destroy()
示例#6
0
    def OnIntersection(self, event):
        wk = self.parent.tree.currentWorkGroup
        if wk is None:
            return

        if event.GetId() == self.IntersectionNptsID:
            npts = wk.preferences.intersection["npts"]

            from customDialogs import edtTxtDialog
            dlg = edtTxtDialog(None, title="Edit Resolution", size=(200,75) )
            dlg.setValue(str(npts))
            dlg.ShowModal()
            try:
                value = int(dlg.getValue())
            except:
                value = npts
            wk.preferences.set_intersection("npts", value)
            dlg.Destroy()
示例#7
0
    def createArc(self):
        wk = self.workGroup
        list_P = wk.viewer.MarkerPoints
        if len(list_P) != 3 :
            print("You have to specify 3 markers.")
            return

        dlg = edtTxtDialog(None, title="Edit Angle")
        dlg.ShowModal()
        ls_text = dlg.getValue()
        try:
            lr_degree = float(ls_text)
        except:
            lr_degree = 0.0

        theta = lr_degree * pi / 180

        dlg.Destroy()

        A0 = list_P[0]
        A1 = list_P[1]
        A2 = list_P[2]

        knots       = [0.,0.,0.,1.,1.,1.]
        C           = np.zeros((3,3))
        C[0,:]      = A0[:3]
        C[1,:]      = A1[:3]
        C[2,:]      = A2[:3]
        weights     = [1.,cos(theta),1.]

        nrb = cad_nurbs([knots], C, weights=weights)

        wk.viewer.CleanMarkerPoints()
        geo = cad_geometry()
        geo.append(nrb)
        wk.add_geometry(geometry(geo))
        wk.Refresh()
示例#8
0
    def createArc(self):
        wk = self.workGroup
        list_P = wk.viewer.MarkerPoints
        if len(list_P) != 3:
            print("You have to specify 3 markers.")
            return

        dlg = edtTxtDialog(None, title="Edit Angle")
        dlg.ShowModal()
        ls_text = dlg.getValue()
        try:
            lr_degree = float(ls_text)
        except:
            lr_degree = 0.0

        theta = lr_degree * pi / 180

        dlg.Destroy()

        A0 = list_P[0]
        A1 = list_P[1]
        A2 = list_P[2]

        knots = [0., 0., 0., 1., 1., 1.]
        C = np.zeros((3, 3))
        C[0, :] = A0[:3]
        C[1, :] = A1[:3]
        C[2, :] = A2[:3]
        weights = [1., cos(theta), 1.]

        nrb = cad_nurbs([knots], C, weights=weights)

        wk.viewer.CleanMarkerPoints()
        geo = cad_geometry()
        geo.append(nrb)
        wk.add_geometry(geometry(geo))
        wk.Refresh()