Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activate particular Simplified representation #47

Open
akash9470 opened this issue Apr 6, 2022 · 9 comments
Open

activate particular Simplified representation #47

akash9470 opened this issue Apr 6, 2022 · 9 comments

Comments

@akash9470
Copy link

  • Creo version:
  • Creopyson version:
  • Creoson version:
  • Python version:
  • Operating System:

Description

i am trying to activate particular Simplified representation in creo and export it in stp format

What I Did

import creopyson
c = creopyson.Client()
c.connect()
c.creo_set_creo_version(7)

c.creo_cd("O://Saran_CD//Vericut _Block Line//03_Workout//Block OP70 3D model Creation//3D models from Saran//4 CYLINDER//RE557794 (Check by Saran)")
c.file_open("re557794_mfg.prt")

c.file_list_simp_reps_(rep="op030")
c.interface_export_file("step")
@Zepmanbc
Copy link
Owner

Zepmanbc commented Apr 6, 2022

Hi @akash9470
file_list_simp_reps only list simplified reps
you should do a mapkey to activate the simplified rep
something like this:

c.interface_mapkey(
    f"~ Command `ProCmdViewVisTool` ;\
    ~ Select `visual_dlg0` `RadioSelApplMgr` 1 `simplified rep`;\
    ~ Activate `visual_dlg0` `Table` 2 `{simplified_rep_name}` `name_column`;\
    ~ Activate `visual_dlg0` `EvalRepRulesBtn`;\
    ~ Activate `visual_dlg0` `CloseBtn`;"
 )

@akash9470
Copy link
Author

i tried using same mapkey but it is not working

c.interface_mapkey(
f"~ Command ProCmdViewVisTool ;
~ Select visual_dlg0 RadioSelApplMgr 1 simplified rep;
~ Activate visual_dlg0 Table 2 op020 name_column;
~ Activate visual_dlg0 EvalRepRulesBtn;
~ Activate visual_dlg0 CloseBtn;"
)

@DieSwartKat
Copy link

@akash9470

try using :

c.interface_mapkey(
f"""~ Command `ProCmdViewVisTool` ;
~ Select visual_dlg0 RadioSelApplMgr 1 simplified rep;
~ Arm `visual_dlg0` `Table` 2 `op020` `name_column`;
~ Select `visual_dlg0` `Table` 2 `op020` `name_column`;
~ Arm `visual_dlg0` `Table` 2 `op020` `name_column`;
~ Activate `visual_dlg0` `Table` 2 `op020` `name_column`;
~ Activate `visual_dlg0` `CloseBtn`;""")

@akash9470
Copy link
Author

ok...
i want run that mapkey for loop and take input from FILE_LIST_SIMP_REPES module
my code is as below.........

a='OP020'

map="~ Command ProCmdViewVisTool ;
mapkey(continued) ~ Select visual_dlg0 RadioSelApplMgr 1 simplified rep;
mapkey(continued) ~ Arm visual_dlg0 Table 2 {ab} name_column;
mapkey(continued) ~ Select visual_dlg0 Table 2 {ab} name_column;
mapkey(continued) ~ Arm visual_dlg0 Table 2 {ab} name_column;
mapkey(continued) ~ Activate visual_dlg0 Table 2 {ab} name_column;
mapkey(continued) ~ Activate visual_dlg0 CloseBtn;".format(ab=a)

c.interface_mapkey(map)
.
.
..
it is not working you have any other option

@DieSwartKat
Copy link

What version of python are you using?

@akash9470
Copy link
Author

python 3.7

@DieSwartKat
Copy link

okay, so it seems when you passing in ab you need to do it as lowercase, not uppercase.

@DieSwartKat
Copy link

I'm not using the creopyson, but my own flavour of CREOSON... here is my code

import BarrowsCreosonLibrary

_creoson = BarrowsCreosonLibrary()


simps = _creoson.list_simp_reps({})['reps']

for x in simps:
    simp = x.lower()
    text = f"""~ Command `ProCmdViewVisTool` ;
~ Select visual_dlg0 RadioSelApplMgr 1 simplified rep;
~ Arm `visual_dlg0` `Table` 2 `{simp}` `name_column`;
~ Select `visual_dlg0` `Table` 2 `{simp}` `name_column`;
~ Arm `visual_dlg0` `Table` 2 `{simp}` `name_column`;
~ Activate `visual_dlg0` `Table` 2 `{simp}` `name_column`;
~ Activate `visual_dlg0` `CloseBtn`;"""
    _creoson.mapkey_function(text)
    _creoson.interface_export_file("step")

@Zepmanbc
Copy link
Owner

Zepmanbc commented Apr 8, 2022

@akash9470 the f before your string is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants