ketchUp草图大师从4.0版本开始提供了Ruby接口,从此让SketchUp插入了腾飞的翅膀!目前,我们都可以“窗口”菜单下,找到“Ruby控制台”!
在“窗口”菜单下打开“Ruby控制台”后,就会弹出一个面板(如下图所示)。我们可以里里面输入各种ruby代码与SketchUp进行互动。
比如,我们可以输入:puts”hello”,SketchUp也会回复你:hello。
再比如,我们如何输入:Sketchup.send_action 10501的话,SketchUp的视图就会自动切换到顶视图。
所以,如果您代码知识足够的话,是可以在Ruby控制台来完成很多工作的。下面和各位SketchUp爱好者分享一下常用的Rbuy代码。
常用代码:
操作步骤:打开SketchUp / 菜单栏“窗口”/ Ruby 控制台,输入 Sketchup.send_action加空格加5位代码 回车就可运行了。比如,“10501: (设置为顶视图)set view to Top”这个代码,我们就只要输入:Sketchup.send_action 10501并回车。
10501: (设置为顶视图)set view to Top
10502: (设置为前视图)set view to Front
10503: (设置为右视图)set view to Rear# 10504: (设置为左视图)set view to Left
10505: (设置为后视图)set view to Right# 10506: (设置为底视图)set view to Bottom
10507: (设置轴测视图)set view to Axonometric# 10508: (环绕观察工具)
10509: (缩放相机工具)# 10519: (设置为平行投影)set camera to ortho (removes perspective)
10521: (系统设置对话框)display the System Preferences dialog box (Files tab)
10522: (隐藏/显示红蓝绿轴)removes axes display
10523: (平移工具)pan
10525: (设置视线高度)set the interactive eye height feature
10526: (缩放窗口工具)zoom window# 10527: (充满视窗工具)zoom extents
10529: (返回上一次视图)zoom out 2
10531: (标准工具栏打/关)toggle the Standard toolbar
10532: (相机工具栏开/关)toggle the Camera toolbar
10533: (阴影设置对话框)display the Shadows Settings dialog box
10537: (视图工具栏开/关)toggle the Views toolbar
10538: (模型信息对话框)display the System Preferences dialog box (Display tab)
10545: (阴影开/关)toggle Color ByLayer
10546: (阴影工具栏开/关)toggle Shadows toolbar
10551: (工具图标放大/缩小)toogle Large icons# 10576: (样式工具栏开/关)toggle Render Mode toolbar
10596:(X 光模式显示)set Render Mode to No Transparency (Preferences)
10597: (线框模式显示)set Render Mode to Wire (Preferences)
10598: (消隐模式显示)set Render Mode to Transparency (Preferences)
10599: (着色模式显示)set Render Mode to Surfaces Shading (Preferences)
10600: (材质模式显示)set Render Mode to Texture (Preferences)
10601: (单色模式显示)set Render Mode to No Texture (Preferences)
10602: (阴影开/关)toggle Shadows
10603: (轮廓线开/关)toggle Profiles
10604: (扩展延长线开/关)toggle Extension Lines
10605: (抖动线开/关)toggle Jitter edges
10624:(打开隐藏相机设置面板)使用方法
21019: (橡皮工具)Hide Status bar and VCB
21020: (直线工具)Show Status bar and VCB
21022: (选择工具)Hide Status bar and VCB
21024: (测量工具)select the Measure tool
21031: (手绘线工具)select the Freehand Draw tool
21041: (推拉工具)select the PushPull tool
21048: (移动/复制工具)select the Move tool
21052: (隐藏选中的物体)hide selected objects
21056: (选中封闭的边线创建面)Create face with selected edges closed loop
21057: (量角器工具)select the Protactor tool
21060: (显示组件对话框)display Components Window
21061: (绘图工具栏栏开/关)toggle Draw toolbar# 21065: (圆弧工具)select the Arc tool
21067: (添加场景页面)creat a new Page
21074: (材质油漆桶工具)show the Materials Browser Window
21078: (删除场景页面)select the Paint Bucket tool
21080: (打开场景管理对话框)display the Page Manager Window
21094: (矩形工具)select the Rectangle tool
21095: (多边形工具)select the Polygon tool
21096: (绘圆工具)select the Circle tool
21098: (打开文件对话框)open the Open Window
21100: (偏移工具)select the Offset tool
21101: (全选)slect all objects
21124: (有效性检测报告)launch the validity check tool
21126: (坐标轴设置)select the Axes tool
21029: (旋转工具)select the Rotate tool
21032: (图层工具条开/关)toggle Layer toolbar
21169: (定位相机)select the Position Camera tool
21200: (插入2D图像对话框)display the Insert Image Window
21236: (比例缩放工具)select the Scale tool
21237: (导出2D图形对话框)display the Export 2D Graphics Window
21245: (多边形偏移系数)display a Polygon Offset Factors dialog box
21337: (剖面工具)select the Section Plane Placement tool
21354: (打开图层管理面板)open the Layer Window
21386: (导出场景动画对话框)open the Export Animation Window
21405: (文字标注工具)select the Text tool
21406: (雾化控制面板)display Fog dialog box
21410: (尺寸标注)select the Dim tool
21433: (编辑工具条开/关)toggle Edit toolbar
21442: (路径跟随工具)select the FollowMe tool
21460: (打开欢迎界面)display Licence
21466:(显示快速开始文件)display Quick reference Card in Adobe Reader
21477: (快捷键位表)List accelerators in window
21488: (图元信息面板)display Entity Info Window
21490:(柔化边线工具)display Soften Edges Window
21494: (相机视野)select Field of view tool
21513: (大纲管理面板)display a tree of the model with selectable items
Ruby控制台可以做很多事情,比如还可以检查插件报错原因。当一个插件不兼容SketchUp的时候,我们可以打开Ruby控制台,这时它就会提示一些错误原因。
注:更详细教程请查看 https://www.sketchupvray.com/2577.html