cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to change PART model with Excel VBA

cko
12-Amethyst
12-Amethyst

How to change PART model with Excel VBA

1. Define the dimension name of the PART model in uppercase English letters.

 
 

그림1.png

 2. program execution code

     [Please refer to the attached file for Excel VBA code.]
**********************************************************************************

Dim BaseSession As pfcls.IpfcBaseSession
Dim Session As IpfcSession
Dim model As pfcls.IpfcModel
Dim Solid As IpfcSolid
Dim ModelItemOwner As IpfcModelItemOwner

'// Current Model Information
Set BaseSession = conn.Session
Set model = BaseSession.CurrentModel
Set Solid = model
Set ModelItemOwner = Solid

*****

'// SET Regenerate
Dim RegenInstructions As New CCpfcRegenInstructions
Dim Instrs As IpfcRegenInstructions
Set Instrs = RegenInstructions.Create(False, False, Nothing)

Dim BaseDimension As IpfcBaseDimension

 

Dim j As Long

For j = 0 To rng.Count - 1

Set BaseDimension = ModelItemOwner.GetItemByName(EpfcModelItemType.EpfcITEM_DIMENSION, Cells(j + 6, "B"))

'// Send entered dimension values to model
BaseDimension.DimValue = Cells(j + 6, "C")

Next j

'// Regenerate
Call Solid.Regenerate(Instrs)
Call Solid.Regenerate(Instrs)

'// Window Repaint
Dim Window As pfcls.IpfcWindow
Set Window = BaseSession.CurrentWindow

Window.Repaint

conn.Disconnect (2)
*****************************************************
How to use the program

1. Change the name of a dimension in a model.
    . Example) ADD375 -> DOM01

2. Enter the name of the dimension in your model under Cells(6,B).
    .Three or more sizes are also possible.

3. Click the GET button
    . Retrieves dimension values from model

4. Click the Change button
    . Change the dimension value and click the change button

0 REPLIES 0
Announcements


Top Tags