Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

exp2python.exe built in VS2019 converts into unparsable code for python3 from AP214&AP242 exp files #427

Copy link
Copy link
@belre

Description

@belre
Issue body actions

Hi,
I need to reorder ap214 or ap242 python code generated exp2python.exe when I use them as python STEP module in windows.
exp2python.exe was generated in VS2019 professional by building cpp codes of SC.sln which were generated after cmake generation.

I'm checking python code in python 3.9.7, but the issue could be replicated in the other python environment because converted code declares with its def function and global variable invalid ordering.

I can reduce the problems by reordering the declaration parts ... but we're not recommended to edited them.

1. AP214

In command prompt,

> SET PATH_TEMP=F:\STEPLibrary\github\py_stepcode\
> %PATH_TEMP%\cmake-build\Debug\bin\exp2python %PATH_TEMP%\data\ap214e3\AP214E3_2010.exp

exp2python.exe generated 'automotive_design.py' and after I imported it:

>>> from automotive_design import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\STEPLibrary\github\py_stepcode\src\exp2python\python\example\automotive_design.py", line 1332, in <module>
    ypr_rotation = ARRAY(ypr_index(ypr_enumeration.yaw),ypr_index(ypr_enumeration.roll),'REAL', scope = schema_scope)
NameError: name 'ypr_index' is not defined

So, copy the file renamed as 'automotive_design_reorder.py' and _ def ypr_index_ (40260 line) _ ypr_enumeration _(1799 line) moved after import declaration:

>>> from automotive_design import *
>>>

Then, I checked import process.

2. AP242

exp2python.exe generated 'ap242_managed_model_based_3d_engineering_mim_lf.py' and after I imported it:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\STEPLibrary\github\py_stepcode\src\exp2python\python\example\ap242_managed_model_based_3d_engineering_mim_lf.py", line 76001
    if id_valid  ==  TRUE:
IndentationError: expected an indented block

I checked an indent was omitted at 76001 line

####################
 # FUNCTION validate_attribute_id #
####################
def validate_attribute_id(attid,):
	'''
	:param attid
	:type attid:STRING
	'''
	if ( not (attid[1]  ==  letters)):
		id_valid = FALSE
	for i in range(2,id_length,1):
if id_valid  ==  TRUE:
			if ( not (attid[i]  ==  valid_chars)):
				id_valid = FALSE
	return id_valid

and I corrected. Then I interpreted python code again:

>>> from ap242_managed_model_based_3d_engineering_mim_lf_reorder import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "F:\STEPLibrary\github\py_stepcode\src\exp2python\python\example\ap242_managed_model_based_3d_engineering_mim_lf_reorder.py", line 2419, in <module>
    ypr_rotation = ARRAY(ypr_index(ypr_enumeration.yaw),ypr_index(ypr_enumeration.roll),'REAL', scope = schema_scope)
NameError: name 'ypr_index' is not defined

the error is similar to automotive_design.py, so reorder after import declaration and interpreted again:

>>> from ap242_managed_model_based_3d_engineering_mim_lf_reorder import *
>>>

By the way, How do you think these errors should be originated from *.exp file or exp2python?
I wish these problems happened due to my operation mistakes...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.