I want to realize the function of DCL in rhino

AUTOCAD-DCL
Panel position can be memorized,The demonstration is the function of DCL in Autocad

-- coding: utf-8 --

import Eto as e
import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
class aa(e.Forms.Dialog):
def init(self):
self.Title = ‘【纵 横】’
layout1 = e.Forms.DynamicLayout()
def OnLine1(sender,e):
self.cl1(‘A1’)
rs.Command(‘_Lock’)
layout1.AddRow(e.Forms.Button(Text=‘锁 定’,Height=25,ID=‘A1’,BackgroundColor=e.Drawing.Color(123,123,1) ,click = OnLine1))
def OnLine2(sender,e):
self.cl1(‘A2’)
rs.Command(‘_UnlockSelected’)
layout1.AddRow(e.Forms.Button(Text=‘解锁选取’,Height=25,ID=‘A2’,click = OnLine2))

    def OnLine3(sender,e):
        self.cl1('A3')
        rs.Command('_Unlock')
    layout1.AddRow(e.Forms.Button(Text='解 锁',Height=25,ID='A3',click = OnLine3))
    layout2 = e.Forms.DynamicLayout()
    def OnLine1(sender,e):
        self.cl1('B1')
        rs.Command('_InterpcrvOnSrf')
    layout2.AddRow(e.Forms.Button(Text='曲面上曲线',Height=25,ID='B1',BackgroundColor=e.Drawing.Color(255,1,0) ,click = OnLine1))
    def OnLine2(sender,e):
        self.cl1('B2')
        rs.Command('_Sweep1')
    layout2.AddRow(e.Forms.Button(Text='单 轨',Height=25,ID='B2',click = OnLine2))
    
    def OnLine3(sender,e):
        self.cl1('B3')
        rs.Command('_Sweep2')
    layout2.AddRow(e.Forms.Button(Text='双 轨',Height=25,ID='B3',click = OnLine3))
    
    
    layout = e.Forms.DynamicLayout()
    layout.AddRow(layout1,layout2)
    self.AbortButton = e.Forms.Button(Text = 'Esc',Height=25,click = self.cl2,BackgroundColor=e.Drawing.Color(1,1,0))

    layout2.AddRow(self.AbortButton)
    try:
        layout.FindChild(sc.doc.Notes).Focus()
    except:
        pass
    self.Content = layout
    
    
    
def cl1(self,bid):
    sc.doc.Notes=bid
    self.Close()
def cl2(self,sender,e):
    self.Close()
def jj(self,sender,e):
    self.Close()

a = aa()
rc = a.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

1 Like