|
问题是我现在要解决的问题就是“工具图标”与“显示模型”是如何关联。
生成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
关键是我点击图标后,要弹出给对话框,输入参数,确定后就生成了模型。
也就是“点击图标”与“生成模型”是如何联系的。
不胜感激! |
|