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

FEAT: get the path of a circuit component #5598

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

gkorompi
Copy link
Contributor

@gkorompi gkorompi commented Dec 19, 2024

Description

Retrieve the path of a Circuit component, specifically spice imported spice models etc.

Issue linked

Please mention the issue number or describe the problem this pull request addresses.

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have agreed with the Contributor License Agreement (CLA).

@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@gkorompi gkorompi linked an issue Dec 19, 2024 that may be closed by this pull request
@gkorompi gkorompi changed the title FEATURE: get the path of a circuit component FEAT: get the path of a circuit component Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 85.27%. Comparing base (334d730) to head (dcf3bfa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5598      +/-   ##
==========================================
+ Coverage   85.25%   85.27%   +0.01%     
==========================================
  Files         152      152              
  Lines       60944    60957      +13     
==========================================
+ Hits        51960    51980      +20     
+ Misses       8984     8977       -7     

@SMoraisAnsys
Copy link
Collaborator

SMoraisAnsys commented Dec 20, 2024

Please provide a description to your PR, see the current one

image

Copy link
Collaborator

@SMoraisAnsys SMoraisAnsys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gkorompi thanks for the contribution !

I'm not sure about the specific location that you are hard coding.

Are you sure this information will be here for every cases ? When going around pyaedt code sources, I found cases where "NAME:CosimDefinition" was first in the list but the 12th element wasn't a list (so couldn't be caught through [1]).

If I'm wrong and the 12th element is correct, is this place the same for every version of AEDT? If not, could you update the code ?

for i in self._circuit_components.o_component_manager.GetData(component_definition):
if type(i) == list and type(i[0]) == str:
if i[0] == "NAME:CosimDefinitions":
return (i[1][12][1].split(" ")[1])[1:-1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkorompi are you sure that the information you are looking for is always in the same location [1][12][1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right @gmalinve i will implement it for all cases. Thanks

src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py Outdated Show resolved Hide resolved
@gmalinve
Copy link
Contributor

gmalinve commented Jan 7, 2025

@gkorompi I left a couple of comments but I'd handle the property in a different way. Something like:

component_definition = self.component_info["Info"]
    component_data = self._circuit_components.o_component_manager.GetData(component_definition)
    
    if not component_data:
        self._circuit_components._app.logger.warning("Component has no path")
        return False

    for data in component_data:
        if isinstance(data, list) and isinstance(data[0], str) and data[0] == "NAME:CosimDefinitions":
            return (data[1][12][1].split(" ")[1])[1:-1]
    
    return False

be sure that what you are lloking for is always in this same location: data[1][12][1].

@gkorompi gkorompi requested a review from MaxJPRey January 14, 2025 12:26
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.

Get Component Definition Path for Circuit Components
5 participants