SketchUp转换操作符的Ruby次开发指南

ruby 专栏收录该内容
¥59.90 ¥99.00
61篇文章

在SketchUp中,我们可以使用Ruby语言进行次开发,以扩展软件的功能和自定义操作。本文将介绍如何使用Ruby进行SketchUp转换操作符的开发。我们将详细说明转换操作符的概念,并提供相应的源代码示例。

什么是转换操作符?

转换操作符是一种在SketchUp中使用的功能,用于对模型进行转换和变换。它们可以应用于选择的实体或组件,并通过应用矩阵转换来改变它们的位置、旋转或缩放。转换操作符可以用于创建复杂的模型变换,例如将对象移动到新位置、旋转对象以及缩放对象的大小。

使用Ruby编写转换操作符

要使用Ruby编写转换操作符,我们需要使用SketchUp的API。以下是一个示例代码,展示了如何创建一个简单的转换操作符,将选定的对象向右移动10个单位:

# 选择要转换的对象
selection = Sketchup.active_model.selection
entities = selection.to_a

# 创建一个移动的转换操作符
二、Sketchup用ruby进行二次开发--Sketchup转换操作符 我这里有一张表, 阅读详情

相关推荐

SketchUp Ruby插件开发:从环境搭建到性能优化

3D建模软件的二次开发是提升设计效率的关键技术,其中SketchUp凭借其开放的Ruby API成为建筑可视化领域的首选。通过Ruby语言进行插件开发,开发者可以扩展核心建模功能,实现参数化设计、批量处理等自动化操作。在工程实践中,合理选择开发工具链(如VS Code+Ruby扩展)和遵循SketchUp特有的实体管理机制尤为重要。本文以家具参数化项目为例,详解如何通过PushPull工具优化几何创建性能,并分享使用grep替代遍历查询的10倍性能提升技巧,为CAD/CAE领域的工具开发提供实用参考。

weixin_31102231的博客 331

SketchUp(Ruby)二次开发02_Ruby Code Editor入门指南

本文详细介绍了SketchUp(Ruby)二次开发中Ruby Code Editor的入门指南,包括界面布局、核心功能、实用技巧与调试方法。通过具体代码示例展示了如何利用该编辑器进行高效开发,特别适合初学者快速上手SketchUp二次开发。

weixin_29003437的博客 279

SketchUp(Ruby)二次开发03_SketchUp Ruby API学习方法

SketchUp Ruby API的学习方法介绍

CQ9527AIR的博客 1032

一键转换:SketchUp格式转换插件

​3dconvert_for_sketchup插件是3D模型在线转换工具集中的一种,面向sketchup模型进行格式转换。3dconvert_for_sketchup插件支持将.skp或导入sketchup中的模型文件,转换为其他模型格式(GLTF、OBJ、GLB、DAE、STL、OFF、XYZ、AMF、3MF和PLY)。

2403_89598061的博客 6525

视频教程-3D建模理论与实战 - 使用Ruby进行SketchUp(草图大师)插件开发-其他

3D建模理论与实战 - 使用Ruby进行SketchUp(草图大师)插件开发 ...

weixin_27674113的博客 1165

SketchUp软件二次开发:Ruby脚本在SketchUp中的应用

Ruby是一种动态、面向对象、通用的编程语言,由Yukihiro Matsumoto(松本行弘)在1990年代中期设计并开发。它结合了Perl的灵活性、Smalltalk的面向对象能力、Python的简洁语法以及C的高效性。Ruby的设计哲学强调代码的可读性和简洁性,使得它成为一种易于学习且功能强大的语言。# 定义一个方法#{name# 定义一个方法 def greet(name) puts "Hello, #{ name }!

kkchenjj的博客 1460

SketchUp软件二次开发(3):SketchUp插件开发流程与技巧

定义一个函数,用于计算两个数的和# 返回两数之和end# 调用函数并打印结果#{53# 定义一个函数,用于计算两个数的和 def add_numbers(a , b) # 返回两数之和 return a + b end # 调用函数并打印结果 puts "The sum of 5 and 3 is: #{ add_numbers(5 , 3) } "开发一个插件,允许用户自定义材质,包括颜色、纹理和透明度,以增强SketchUp的材质编辑功能。

kkchenjj的博客 2252

SketchUp:插件与扩展工具使用教程_2024-07-16_08-30-54.Tex

在SketchUp中,自定义插件快捷键可以极大地提高工作效率,使您能够快速访问常用的插件功能。打开SketchUp,点击菜单栏中的“窗口”(Window)。选择“模型信息”(Model Info),然后点击“快捷键”(Shortcuts)。在弹出的对话框中,您会看到所有可用的命令列表,包括SketchUp自带的命令和已安装插件的命令。找到您想要设置快捷键的插件命令,例如“动态组件编辑”(Dynamic Component Editing)。

2543

SketchUp汉化详解及应用技巧指南

SketchUp,作为一款广受欢迎的三维建模软件,已成为建筑师、室内设计师、景观设计师等创意专业人士的首选工具。自2000年首次推出以来,它的直观操作和丰富的功能使设计师能够快速将他们的想法转化为三维模型。SketchUp的核心优势在于其简化的用户界面和易学易用的工具集合,使得即便是初学者也能在短时间内掌握基础操作。软件内置了丰富的绘图和建模工具,并支持导入各种格式的二维和三维数据,从而可以无缝地与其他设计软件和平台进行协作。

weixin_35677363的博客 1181

SketchUp Ruby脚本编辑器完整工具包与实战应用

示例:通过 as_rubyeditor.rb 启动编辑器AS::RubyEditor.open # 打开增强型脚本编辑窗口该工具基于主控脚本构建,采用模块化架构,支持第三方扩展接入。它不仅优化了编码交互流程,还通过 GUI 渲染技术和后台解析机制的结合,实现了稳定高效的开发闭环,已成为 SketchUp 社区广泛采用的开发辅助利器。对于超过百行的脚本,快速定位函数入口至关重要。编辑器支持“区域折叠”与“大纲视图”功能,自动生成导航面板:同时,在代码中插入水平分隔线(如。

weixin_35750483的博客 1107

sketchup-ruby-api-tutorials:SketchUp Ruby API教程和示例

入门与教程 示例扩展 我们经常发现,我们需要的培训水平不仅要超出基础知识,而且还比仅仅阅读API文档提供更多信息。 别再看了! 请查看我们的“示例扩展”部分,以获取功能齐全的SketchUp扩展的示例,并附带注释和有用的提示。 如何使用这些教程? 希望您可以根据需要使用这些示例。 示例代码可用3种不同方式提供。 你可以: 阅读的。 通读代码和注释的分步教程,并尝试自己构建相同的扩展。 使用这些示例有助于更好地了解SketchUp API的用法。 分叉的。 在您的计算机上获取代码,并附带所有注释,以方便访问。 将其用作注释,代码段等的快速参考。 分叉的。 对于只想快速查看代码并继续前进的人们来说,这很方便。 您可以轻松地从未注释的示例中复制和粘贴代码块,而不会造成冗长的注释。 根据您要实现的目标,有一种方法可以轻松实现目标。 只需一次获取所有代码,然后取出您需要的内容即可。 或按照

从ENVI SARscape到SNAP:手把手教你迁移哨兵1 GRD数据预处理流程(含避坑指南)

本文详细介绍了从ENVI SARscape迁移到SNAP处理哨兵1 GRD数据的全流程,包括工具哲学差异、数据准备注意事项、核心处理流程等效实现及地形校正技巧。特别针对雷达数据预处理中的常见陷阱提供避坑指南,帮助用户高效完成工具迁移并确保结果质量。

weixin_28677005的博客 485

Ultralytics YOLO模块自定义与替换实战技巧

本文详细介绍了在Ultralytics YOLO框架中进行模块自定义与替换的实战技巧。通过从零开始添加全新模块(如注意力模块)到进阶替换现有模块(如增强版卷积),并涵盖模块注册、YAML配置、模型融合及ONNX导出等关键步骤,帮助开发者深度定制YOLO模型,以应对复杂检测任务与部署需求。

numpy6sculptor的博客 930

交换机救命命令手册:华为 & 思科平台最全运维指令速查表

很多时候,真正拉你一把的不是“高深理论”,而是你手里有没有一份靠得住的命令速查表。这篇文章,希望能成为你“进可调试,退可排障”的一份救命卡片。

HuaweiLab_Peach的博客 1515

广义平均(Generalized Mean, GeM)

本位介绍了广义平均操作的定义和简要推导,帮助大家理解其含义。

qq_45802280的博客 4547

SAP Workflow 工作流开发步骤总结

SAP WORKFLOW

qq_36952606的博客 5091

LeetCode 热题 100 回顾

力扣最受刷题发烧友欢迎的 100 道题 LeetCode 热题 100 : 题目回顾、解题思路、复杂度分析、代码实现、验证算法

曾经“等你生日那天”都遥远得像未来,如今却可欢愉的挥手说“下个十年见” 9万+

PyTorch生成式人工智能(25)——基于Transformer实现机器翻译

不同于循环神经网络 (RNN) 按顺序处理数据,Transformer 以并行的方式处理输入数据(例如句子)。这种并行处理提高了效率,但并未使其能够识别输入的顺序。为了解决这个问题,Transformer 向输入的词嵌入中添加了位置编码。这些位置编码是分配给输入序列中每个位置的独特向量,其维度与输入词嵌入对齐。本节将以英语到法语的翻译为例,通过介绍如何训练 Transformer 模型将英语句子转换为法语,深入理解 Transformer 的架构及自注意力机制的运作方式。

盼小辉丶的博客 2725

智能车图像处理19-进阶篇11--斜入十字补线

这篇文章主要讲述智能车竞赛中如何对于斜入十字进行补线操作。

taiyuezyh的博客 7481

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

上一篇: 在Ubuntu 18上安装Ruby on Rails
下一篇: Ruby中设置Gem代理的方法
普通网友
博客等级 码龄3年 8粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值