array copy rotate in Pointwise

goal:

#
# Copyright 2010 (c) Pointwise, Inc.
# All rights reserved.
#
# This sample Pointwise script is not supported by Pointwise, Inc.
# It is provided freely for demonstration purposes only.
# SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
#

###############################################################################
##
## ArrayCopyRotate.glf
##
## Script to create copy all grid and database entities a user-prescribed
## number of times about a user-prescribed axis and angle.
##
###############################################################################

package require PWI_Glyph 2

############################################################################
# Define all user parameters
############################################################################

set RotAxis1 "0 0 0"
set RotAxis2 "1 0 0"
set RotAngle 60
set numRotCopies 2

############################################################################
# Get and assign all database and grid entities to a variable.
############################################################################

set AllDB [pw::Database getAll]
set AllGrid [pw::Grid getAll]
set AllEnts [concat $AllDB $AllGrid]

############################################################################
## Set up control loop to paste multiple copies based
## on the prescribed rotation angle (RotAngle), the number of
## copies (numRotCopies), and the rotation axis (RotAxis1, RotAxis2).
############################################################################

for {set i 1} { $i <= $numRotCopies} { incr i } {

   # Copy the entities.
   set copyMode [pw::Application begin Copy $AllEnts]
   # Get the pasted entities.
   set Copies [$copyMode getEntities]
   # Set up the transformation.
   set Rotate [pwu::Transform rotation -anchor $RotAxis1 $RotAxis2 [expr $RotAngle*$i]]
   # Rotate the pasted entities.
   pw::Entity transform $Rotate $Copies 

   $copyMode end
}

Reference

https://github.com/pointwise/ArrayCopyRotate

原文地址:https://www.cnblogs.com/code-saturne/p/10479475.html

时间: 2024-08-10 23:42:08

array copy rotate in Pointwise的相关文章

Array.Copy

var bt = new byte[] { 0x03, 0x00, 0x01, 0xD9, 0x23 }; var result = new byte[] { 0x01, 0x00, 0x03, 0x00, 0xFC }; var tmp = new byte[5]; _sp.Write(bt, 0, bt.Length); Thread.Sleep(500); var recive = new byte[_sp.BytesToRead]; _sp.Read(recive, 0, _sp.Byt

C#把某个数组的一部分复制到另一个数组中的两种方法:Buffer.BlockCopy和Array.Copy

static void Main(string[] args) { int[] src = new[] { 1, 2, 3, 4, 5, 6 }; const int destLen = 4;//目标数组大小 int int_size = sizeof(int);//用于获取值类型的字节大小. int[] dest = new int[destLen]; //只支持基元类型,按字节偏移复制 Buffer.BlockCopy(src, (src.Length - destLen) * int_si

[Array]189. Rotate Array

Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note:Try to come up as many solutions as you can, there are at least 3 different ways to solve this pro

C# Array类的浅复制Clone()与Copy()的差别

1 Array.Clone方法 命名空间:System 程序集:mscorlib 语法: public Object Clone() Array的浅表副本仅复制Array的元素,不管他们是引用类型还是值类型.可是不负责这些引用所引用的对象. 新Array中的引用与原始Array的引用指向同样的对象. 例: int[] intArray1 = {1, 2}; int [] intArray2 = (int [])intArray1.Clone(); 这里须要说明的是.须要使用强制类型转换,原因在于

C# Array类的浅复制Clone()与Copy()的区别

1 Array.Clone方法 命名空间:System 程序集:mscorlib 语法: public Object Clone() Array的浅表副本仅复制Array的元素,无论他们是引用类型还是值类型,但是不负责这些引用所引用的对象. 新Array中的引用与原始Array的引用指向相同的对象. 例: int[] intArray1 = {1, 2}; int [] intArray2 = (int [])intArray1.Clone(); 这里需要说明的是,需要使用强制类型转换,原因在于

copy, retain, assign , readonly , readwrite,strong,weak,nonatomic整理

copy:建立一个索引计数为1的对象,然后释放旧对象 对NSString对NSString 它指出,在赋值时使用传入值的一份拷贝.拷贝工作由copy方法执行,此属性只对那些实行了NSCopying协议的对象类型有效.更深入的讨论,请参考“复制”部分. retain:释放旧的对象,将旧对象的值赋予输入对象,再提高输入对象的索引计数为1对其他NSObject和其子类对参数进行release旧值,再retain新值指定retain会在赋值时唤醒传入值的retain消息.此属性只能用于Objective

copy 和 mutableCopy

retain 和 copy 的区别. copy copy是通过旧对象创建一个新对象,新对象引用计数器为1,与旧对象的引用计数无关. retain retain是创建一个指针,对象引用计数加1.retain 出来的指针和原对象的指针指向的内存地址是相同的. 如何实现copy 并不是所有对象都可以进行copy.mutableCopy .对象如果可以被copy 则需要遵守NSCopying , 如果对象可以被mutableCopying 则需要遵从 NSMutableCopying.如果即可以被cop

C#集合类型——Array、ArrayList、List 之浅谈

在学习或工作中,集合是经常用到的,可以换一句话说“无项目无集合”,“项目皆有集合”.它一般存储一系列数据或者将一系列数据进行相关操作.在这里先大略谈一些集合类型的相关知识用于回顾. 数组(Array) 数组一般只存储一种类型的数据,有一维数组,二维数组等多维数组.都基于System.array类. 格式:type[]  typename:  type指类型,typename指数组名称. 一维数组有多种书写形式: int [] a={1,2,3}; int [] b=new int[]{1,2,3

copy&amp;mutableCopy 浅拷贝(shallow copy)深拷贝 (deep copy)

本文来自 这里,原文作者微博MicroCai 概念 对象拷贝有两种方式:浅复制和深复制.顾名思义,浅复制,并不拷贝对象本身,仅仅是拷贝指向对象的指针:深复制是直接拷贝整个对象内存到另一块内存中. 一图以蔽之 再简单些说:浅复制就是指针拷贝:深复制就是内容拷贝. 集合的浅复制 (shallow copy) 集合的浅复制有非常多种方法.当你进行浅复制时,会向原始的集合发送retain消息,引用计数加1,同时指针被拷贝到新的集合. 现在让我们看一些浅复制的例子: NSArray *shallowCop