顯示具有 Creo Excel 標籤的文章。 顯示所有文章
顯示具有 Creo Excel 標籤的文章。 顯示所有文章

2016年11月3日 星期四

[Creo VBA] Easily add or delete parameters from Excel to Creo

Function of Design Automation
                                                             
- Add or Delete parameters by MS Excel
- Batch processing
- Fast and repetitive execution to the Creo

- The demo video only show one function of automation.

/=====================================================/
Easily process parameters from excel to creo

為何要運用Excel簡易的批次處理參數到Creo CAD?

有些設計我們會在不同的model中重複使用到相同的參數,比如LENGTH, WIDTH, DEPTH, PARTNAME, MASS等等的參數,這時候若是要在很多不同的Part(model)中使用,一個一個參數輸入,這是一件非常煩人又無聊的事情,尤其是Creo Parameter table提供給你的輸入方式對比Excel而言非常的不人性化,因此就想到使用Creo API來設計一隻程式可以快速的增加或是刪除參數。

Google translate as follow ~
Some of the design we will be reused in different models to the same parameters, such as LENGTH, WIDTH, DEPTH, PARTNAME, MASS, and so the parameters, this time if in many different Part (model) used, one parameter input , Which is a very annoying and boring things, especially the Creo Parameter table to provide you with the way, compared to Excel is very humane, so you want to use Creo API to design a program that can quickly increase Or delete the parameters.

/=====================================================/

2016年10月28日 星期五

[Creo VBA]Get Mass Properties

Design Automation
- Creo VBA
- Use Excel to Get Mass Properties of Model
- Excel connect to Creo

/=====================================================/
- IpfcParameters
- IpfcParameterOwner
- IpfcParameter
- IpfcBaseParameter
- IpfcParamValue
- IpfcNamedModelItem

/=====================================================/


The demo video







[Creo VBA] Get Parameter

Design Automation
- Creo VBA
- Use Excel to Get Model's Parameter and list.
- Excel connect to Creo

/=====================================================/
- IpfcParameters
- IpfcParameterOwner
- IpfcParameter
- IpfcBaseParameter
- IpfcParamValue

/=====================================================/


The demo video





[Creo API] Open Model

Design Automation
- Creo VBA
- Use Excel to Open Creo 3D Model
- Excel connect to Creo

/=====================================================/
- CCpfcModelDescriptor
- EpfcModelType.EpfcMDL_ASSEMBLY

/=====================================================/


The demo video








[Creo API] Start Creo

Design Automation
- Creo VBA
- Use Excel to Start Creo 3D software
- Excel connect to Creo

/=====================================================/
- CCpfcAsyncConnection
- AsyncConnection

/=====================================================/

The demo video









2016年3月6日 星期日

[Creo VBA] How to update Parameters ?

How to update Parameters?

在前面,有介紹如何變更參數Creo VBA API_由Excel設計變更修改Creo Parameter參數

,這裡用一個簡單的範例來說明參數是如何的更新,以及程式碼的分享。

Here's a simple example to illustrate how to update parameters, and share code.


1) 先在Creo 中設定好模型與參數
     First Create a model and set parameters.




2) 參數表 Parameter table



3) Excel VBA撰寫程式與介面
     Programming and  interface.



4)執行Excel VBA,同步設計變更
   Executive Excel VBA, synchronous design changes.



5) Update Parameter => Excel VBA Code

'-------------------------------------------------------
Private Sub Update_Dim_Click()

Dim px As IpfcParameterOwner
Dim p01(3), p02(3) As String
Dim p1 As IpfcParameter
Dim p2 As IpfcBaseParameter
Dim Mitem As CMpfcModelItem
Dim pv1 As IpfcParamValue

...
...
...

End Sub

'-------------------------------------------------------





2016年2月22日 星期一

[Creo API] 由Excel設計變更修改Creo Parameter參數

上一篇 [Creo VBA API_How to get Parameters quickly? 如何快速獲取參數 ?],如何藉由Excel快速獲取參數 !

藉由Excel取出參數只是一個附屬的功能,真正要做的是「由Excel設計變更修改Creo Parameter參數」進行實現快速的設計自動化;

Get parameter value is only a subsidiary function via Excel,
Really need to do is "From Excel to modify the design changes of Creo Parameter" rapid design automation;

為何這樣說呢?

若你有100個以上的參數要變更,一個一個在設計table表中例出,然後又一一的在Creo 參數表中輸入,那真的會花費許多時間!
If you have more than 100 parameters to change,one by one listed in the table design table , and then another one in Creo input parameter table, it really takes a lot of time!


來看看怎麼實現透過Excel VBA API設計變更修改Creo CAD 參數
Show you how to get the parameter via Excel VBA API

Step 1: Excel VBA API  <=> Creo CAD ,取得Parameter參數






Step 2: 從Excel 修改Parameter參數,黃色欄位 
             Modify Parameter Parameter from Excel, yellow field
    - 1) NO_PT1_CIRCLE  16 => 6
    - 2) TYPE_PT1  2 => 1 
    - 3) TYPE_PT2  2=> 1

請留意,除了數量變動外,特徵已經變更了
The value has been changed and features have changed.






2016年2月21日 星期日

[Creo API] How to get Parameters quickly? 如何快速獲取參數 ?

One buttom gets all the parameters.


上一篇 [Creo Relations_Parameter(參數)],談到了什麼是參數Parameter,當你開始使用簡易的設計自動化時,設定的參數不會太多甚至只有10個以下,但是當設計架構越來越複雜的時候,要細部控制的條件越來越多時,參數往往是超過100個以上 (我有一個專案,目前的控制及非控制參數約300個),在這情況下,若是在Creo的環境中,找參數、改參數、甚至是數參數數量都是一件不簡單的事情。
Previous [Creo Relations Parameter (parameter)], talking about what are the parameters Parameter, when you start using a simple design automation, parameter setting will not be too much even only 10 or less, but when more and more complex design architecture conditions of time, to control more and more detail for a long time, often more than 100 parameters above (I have a project, the current control and non-control parameters approximately 300);
In this case, find the parameters, change parameters, and even the number of calculation parameters are a difficult thing


言歸正傳!

How to get Parameters ? 如何獲取參數 ?

Method 1:
Tools >Parameter>File>Export ,選擇csv or text format,然後用Excel或是筆記本匯入即可(參考下圖)。




匯入Excel的參數列表





How to get Parameters quickly? 

上面,這是每個人都會做的,差別只是知道跟不知道而已,但是這還是太慢了,因為要好幾個步驟,若是常常作,肯定會是一件累人的事情而又沒效率的事情,所以呢?
有沒有什麼方法,可以如何快速獲取參數 ?
Is there any way, how you can quickly get the parameters?

使用Creo VBA API,這部份就是要利用Creo 提供的API撰寫一個Excel VBA API,來讀取參數了,如下。

Use Creo VB API, this part is to use API Creo offers a writing Excel VBA API, to read the parameters, as follows.


Method 2:

Step 1:Open Creo




Step 2:Open Model (找出需獲取參數的檔案)




Step 3: 取得參數的資訊 Get parameters information

這範例,我將Open Model及Get Parameter這兩個步驟寫在一起,所以打開檔案就會自動取得參數
This example, I'll Open Model and Get Parameter write these two steps together, so open file will automatically obtain the parameters.




來比較一下左邊是Creo Parameter 畫面 (螢幕無法擷取全部),右邊是Excel VBA的資料,是不是很簡單呢?
To compare the figure below,the Left information is the Parameter table and the right information is Excel VBA table.

利用Excel VBA API 一個Open的按鍵動作,就將Creo Model中的參數全部取出。

Use Excel VBA API, an Open operation command. Get all of the parameters from Creo Model.