2016年2月1日 星期一

[Creo Relations] Example_1_Auto Pattern No. (自動計算Pattern No.)

在瞭解Relation的程式與用法前,先來看看Relation可以怎麼用,畢竟網路上面太多的範例都是寫用法跟寫說明,但是要怎麼用呢?如何節省你的設計變更時間呢?

Before understanding Relation programs and usage, take a look at how you can use Relation, after all, much above the network usage examples are written with instructions, but how to use it? How to save your design changes time?

以下,我舉例一個設計上面的應用例子,在設計Heatsink時難免都要用到散熱鰭片(這裡忽略不談熱傳學與公式),基本上散熱片都要有長(L)寬(W)高(H)這3個基本的參數,今天有一新的設計或是再討論散熱效率下,可能隨時都要變更長度來對應產品的需求。
結果呢?每次變更長度都要按計算機來算散熱片的數量,這樣是不是很繁瑣,而也可能還會計算錯或是輸入錯誤,因此,來看看怎麼在已知設計參數的情況下,讓Creo自動計算散熱片的數量並立即反應在模型上。

Now, I use the example of a design example above, when it is inevitable in the design Heatsink fins should be used (here ignore that science and heat transfer equations), basically fins must have length (L) Width (W) High (H) three basic parameters.
Today there is a new design or a discussed under thermal efficiency, demand may change at any time should correspond to the length of the product.
The result? The length of each change must be using a computer to calculate the number of fins, this is not very complicated, but it may also miscalculate or input errors; therefore, to see how in the known design parameters, let Creo automatic calculation of the number of fins and immediately reflected in the model.



Parameter:
1. Length  (L)   =>期望變動的設計值 Design changes in the desired value
2. Width   (W)
3. FIN_HEATSINK_PITCH
4. FIN_HEATSINK_PITCH_PAD
5. FIN_HEATSINK_SAPCE
6. NO_FIN_HEATSINK






Relation:
--------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------

Relation 說明:
1)
FIN_HEATSINK_PITCH_PAD=2
FIN_HEATSINK_SPACE=4
這定義成固定值(也可不定義由Parameter輸入),若是有變動再來調整數值即可

This is defined as a fixed value (or not defined by Parameter input), if there are changes you can adjust the values again

2) FIN_HEATSINK_PITCH定義Pattern的Pitch,由FIN_HEATSINK_PITCH_PAD & FIN_HEATSINK_SPACE計算而來

FIN_HEATSINK_PITCH defined Pattern of Pitch, calculated by FIN_HEATSINK_PITCH_PAD & FIN HEAT SINK SPACE.

3)d283 這是Pattern的起始位置,從邊開始算,一樣是FIN_HEATSINK_PITCH_PAD+FIN_HEATSINK_SPACE/2求得

d283 This is the starting position of the Pattern.
Calculated from the edge by FIN_HEATSINK_PITCH_PAD + FIN_HEATSINK_SPACE / 2 is obtained

4)NO_FIN_HEATSINK

從陣列的公式中,要計算N個陣列Total Ptich
From the formula array, to calculate the N array Total Ptich

Total Ptich=Pitch *(No-1)=FIN_HEATSINK_PITCH*(NO_FIN_HEATSINK-1)

所以,若長度是L要計算Pattern的數量,就是
Therefore, if the length is L, to calculate the number of Pattern, that is

L=(FIN_HEATSINK_PITCH_PAD+FIN_HEATSINK_SPACE/2)*2+Total Ptich

  =(FIN_HEATSINK_PITCH_PAD+FIN_HEATSINK_SPACE/2)*2+
     FIN_HEATSINK_PITCH*(NO_FIN_HEATSINK-1)

  =FIN_HEATSINK_PITCH_PAD*2+FIN_HEATSINK_SPACE+
     FIN_HEATSINK_PITCH*(NO_FIN_HEATSINK-1)

求解:
Solving:

 NO_FIN_HEATSINK=
(L-FIN_HEATSINK_PITCH_PAD*2+FIN_HEATSINK_SPACE)/FIN_HEATSINK_PITCH+1


結果:
Result:

1) 設計變更Design change  L= 355 => NO_FIN_HEATSINK=60





2) 設計變更Design change  L= 82=> NO_FIN_HEATSINK=14





由以上的說明,透過數學公式與Relation的程式,可以讓你節省下來按計算機的時間與錯誤的機會發生,而這就是透過Relation得到的最簡單的程式自動化;更深入點透過撰寫API程式,這就是一個小的二次開發插件了。

From the above description, through mathematical formulas and Relation of the program allows you the opportunity to be saved by the computer's time and the occurrence of errors, and this is through the most simple program Relation obtained automation; deeper point by writing API programs, which It is a small secondary development plug-in.

以真正的應用計算,這公式還有需要改進的地方,因為L必須跟 FIN_HEATSINK_PITCH_PAD & FIN_HEATSINK_SAPCE有關聯,動腦想想看加上一些IF判斷式與條件語句寫出自己的演算法,進而讓你的CAD動起來,而不是一步一步的手動更改設計。

In real application terms this formula there is room for improvement, since L must be associated with FIN_HEATSINK_PITCH_PAD & FIN_HEATSINK_SAPCE, brains to think with some judgment formula IF conditional statement to write their own algorithms, and then let your CAD automation, rather than manually step by step to change the design.




版權所有請勿轉載或複製
http://creosimpleautomation.blogspot.tw/
------------------------------------------------------------------------------------------------------------
這Blog作為自己撰寫研究Creo Simple Automation設計自動化的分享。 



沒有留言:

張貼留言