|
|
問題是我現在要解決的問題就是“工具圖標”與“顯示模型”是如何關聯。
生成box很容易,例如
def create_box
prompts = ["Width", "Height", "Depth"]
values = [100.cm, 100.cm, 100.cm]
results = inputbox prompts, values, "Box Dimensions"
return if not results
width, height, depth = results
model = Sketchup.active_model
model.start_operation "Create Box"
entities = model.active_entities
group = entities.add_group
entities = group.entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
base = entities.add_face pts
height = -height if( base.normal.dot(Z_AXIS) < 0 )
base.pushpull height
model.commit_operation
end
關鍵是我點擊圖標后,要彈出給對話框,輸入參數,確定后就生成了模型。
也就是“點擊圖標”與“生成模型”是如何聯系的。
不勝感激! |
|