Loading
0

SketchUp常用ruby代码

文章简介:

SketchUp自学网在《插件安装》一文中,我们对插件的安装进行了详细讲解。其实SketchUp插件是由ruby语言写一些程序,可以扩展SketchUp的功能。用SketchUp原生工具可能几步或者数十步的操作,用插件可能一步就完成了,换句话说插件就是程序自动完成一些复杂的操作。我们平时称呼为“应用”、“扩展程序”、“ruby工具”等,通常都是指插件。

在SketchUp高级建模中,插件的位置是非常特殊的。总得来说可以听到两个声音,一个是“用插件”,另外一个“不用插件”。我个人自然是推荐用插件。为什么?因为软件就是设计表达的工具,有好的工具为什么不用?另外,工作讲的是优质与高效,能提高工作效率的工具为什么不用?所以各位读者也不要觉得用插件不好,反而是一件非常棒的事情。

RUBY控制台:

ruby接口是从SketchUp4.0开始加入的一个接口,在SketchUp4.0中就可以找到ruby控制台。

如果您懂ruby代码,即可在这里实现与SketchUp的互动,比如我们可以输入,puts "hello"并回车,你会发现ruby控制台也会回复你hello

如果有大量的代码的话,您可以实现很多操作。下面是可在ruby控制台上面实现互动的一些代码。

操作步骤:

打开SketchUp / 菜单栏“窗口”/ Ruby 控制台,输入 Sketchup.send_action 加5位代码 回车就可运行了。比如10151是指顶视图,我们只要输入Sketchup.send_action 1051回车即可切换到顶视图。

# 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

本文隐藏内容 登陆 后才可以浏览

如无特意说明,本网站所有内容均为原创。