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

add identification selection #162

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

ptm-tm
Copy link
Contributor

@ptm-tm ptm-tm commented Oct 7, 2023

add example to identification geometry

@ptm-tm ptm-tm changed the base branch from master to developement October 7, 2023 21:55
@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 7, 2023

mb use folder structure for sorting examples and useful scripts?
another its seems like heap)
this example use selection spaworkbench and hybris shape.

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 9, 2023

and some note
used method return number but in catvba exist corresponding enum for example
изображение

@evereux
Copy link
Owner

evereux commented Oct 10, 2023

mb use folder structure for sorting examples and useful scripts?
another its seems like heap)

I don't know what you mean here?


Your pycatia imports are in the wrong place again.


Also, you've done a lot of heavy lifting in your script when you could have used the pre-defined enum types.

for example:

cat_selection_filter = (

cat_measurable_name = (


# import headers
try:
    caa = catia()
    documents = caa.documents
    document = caa.active_document
except CATIAApplicationException as e:
    print(e.message)
    print('CATIA not started or document not ' +
          'opened or started several CATIA sessions')
    print('Press any key to exit...')
    sys.exit(e.message)
if document.is_part:
    # need to autocomplete
    part_document = Part(document.part.com_object)
    selection = document.selection

    try:
        part_document.update()
    except CATIAApplicationException as e:
        print(e.message)
        print('Part document must be without errors!')
        print('Press any key to exit...')
        sys.exit('Part document must be without errors!')

I'm going to have to think about whether to simplify this or not. It's not that it's wrong but it's not consistent with the other examples.

I'm asking myself:

  • why do that here and not on all the other examples?
  • Is it beneficial to add this type of checking for the other examples too?
  • or perhaps simplify this and have this type of checking as an example in itself.

If anyone else is reading this please feel free to let me know what you think.

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 10, 2023

Your pycatia imports are in the wrong place again.
sorry my pylint dont know about this)))
im try to get it simple.
some check work well...

PS may be add folder for example : usefull scripts or another example. in catia was cool document: script center)

@evereux
Copy link
Owner

evereux commented Oct 11, 2023

PS may be add folder for example : usefull scripts or another example. in catia was cool document: script center)

You've lost me again.

https://github.com/evereux/pycatia/tree/master/examples

https://pycatia.readthedocs.io/en/latest/examples.html

formatted for pycatia standarts
@ptm-tm ptm-tm changed the title add identificatio selection add identification selection Oct 11, 2023
@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 11, 2023

PS may be add folder for example : usefull scripts or another example. in catia was cool document: script center)

You've lost me again.

https://github.com/evereux/pycatia/tree/master/examples

https://pycatia.readthedocs.io/en/latest/examples.html

yes i saw this. but if u have many examples- its not simple for user
If you have several examples which uses several catia workbench etc you cannot scpecify to one workbench (this example)

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 11, 2023

im formatting code for pycatia standart...

@evereux
Copy link
Owner

evereux commented Oct 11, 2023

If you have several examples which uses several catia workbench etc you cannot scpecify to one workbench

Agreed.

The way I look at it is this. The example should be simple and focus on showing how to use one primary feature / function only. If you need many workbenches to get to that one feature / function so be it. The example will be named according to that concept.

Now, more advanced examples may not fall under this idea. I'm open to ideas on how they should be named / structured / presented but they'll still need to all be collected in the examples folder.

I'll have a think on this ... might be idea me opening a new issue to see what people think.

@evereux
Copy link
Owner

evereux commented Oct 11, 2023

I've created the following to help you set-up your projects correctly.

#164

Note how the pycatia-git environment does not have pycatia installed from pypi.

If you follow the above, try and run your example(s) in the pycatia-git environment with the pycatia imports at the top of the file. They will not work.

Hopefully, the penny will drop once you follow this. ❓ 😄

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 11, 2023

I've created the following to help you set-up your projects correctly.

#164

Note how the pycatia-git environment does not have pycatia installed from pypi.

If you follow the above, try and run your example(s) in the pycatia-git environment with the pycatia imports at the top of the file. They will not work.

Hopefully, the penny will drop once you follow this. ❓ 😄

they work... but i use some other method ( i change it when you note me what i need 2s env). i will try yours,because
i have some warrnings/error from my pylint)))

my dev folder is
pycatia-dev (env folder)
.Include
.Lib
. pycatia-git-clone
.Scripts
..
..

@evereux
Copy link
Owner

evereux commented Oct 12, 2023

If your examples are running when:

  • they live in the pycatia/examples folder
  • the pycatia imports are before
##########################################################
# insert syspath to project folder so examples can be run.
# for development purposes.
import os
import sys

sys.path.insert(0, os.path.abspath("..\\pycatia"))
##########################################################

You most likely have pycatia installed from pypi.

Pleeeeeease try and understand the significance of sys.path.insert(0, os.path.abspath("..\\pycatia")).

I can't help anymore.

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 12, 2023

If your examples are running when:

* they live in the `pycatia/examples` folder

* the pycatia imports are before
##########################################################
# insert syspath to project folder so examples can be run.
# for development purposes.
import os
import sys

sys.path.insert(0, os.path.abspath("..\\pycatia"))
##########################################################

You most likely have pycatia installed from pypi.

Pleeeeeease try and understand the significance of sys.path.insert(0, os.path.abspath("..\\pycatia")).

I can't help anymore.

im not use installed version pycatia because they dont have input box and some other things.
i think we must do it here
#164

@ptm-tm
Copy link
Contributor Author

ptm-tm commented Oct 12, 2023

PS im fix os import

@evereux evereux merged commit 4a397d1 into evereux:developement Oct 13, 2023
@ptm-tm ptm-tm deleted the identification-selection branch October 13, 2023 09:46
evereux added a commit that referenced this pull request Jun 29, 2024
evereux added a commit that referenced this pull request Jun 29, 2024
siddhu2310 pushed a commit to siddhu2310/pycatia that referenced this pull request Aug 20, 2024
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

Successfully merging this pull request may close these issues.

2 participants