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

ZStart must be 0 in Maxwell 2D #4017

Closed
2 tasks done
Devin-Crawford opened this issue Dec 29, 2023 · 3 comments
Closed
2 tasks done

ZStart must be 0 in Maxwell 2D #4017

Devin-Crawford opened this issue Dec 29, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Devin-Crawford
Copy link
Contributor

Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

The property transparency for 2D primitives does not exist if the ZStart value passed to the native API is non-zero. This can be seen in the unit test test_04_create_rectangle when trying to modify transparency after creating a rectangle.

Steps To Reproduce

Run the following script in the native API. The rectangle transparency cannot be modified.

import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
oProject = oDesktop.GetActiveProject()
oDesign = oProject.GetActiveDesign()
oEditor = oDesign.SetActiveEditor("3D Modeler")
oEditor.CreateRectangle(
	['NAME:RectangleParameters', 
    'IsCovered:=', True, 
    'XStart:=', '10mm', 
    'YStart:=', '-2mm', 
    'ZStart:=', '1mm', 
    'Width:=', '3mm', 
    'Height:=', '10mm', 
    'WhichAxis:=', 'Z'], 
	['NAME:Attributes', 
    'Name:=', 'MyRectangle', 
    'Flags:=', '', 
    'Color:=', '(242  140  102)', 
    'Transparency:=', 0.2, 
    'PartCoordinateSystem:=', 'Global', 
    'SolveInside:=', True, 
    'MaterialValue:=', '"copper"', 
    'UDMId:=', '', 
    'SurfaceMaterialValue:=', '"Steel-oxidised-surface"', 
    'ShellElement:=', False, 
    'ShellElementThickness:=', '0mm', 
    'IsMaterialEditable:=', True, 
    'UseMaterialAppearance:=', False, 
    'IsLightweight:=', False
    ])

change ZStart to 0mm and all is well again.

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

all dependences are installed.

@Devin-Crawford Devin-Crawford added the bug Something isn't working label Dec 29, 2023
@Devin-Crawford Devin-Crawford self-assigned this Dec 29, 2023
Devin-Crawford added a commit that referenced this issue Dec 29, 2023
Addressed a defect #4017 that was identified while updating unit tests.
Added documentation and updated the unit tests to allow properties of primitives to be set using arguments when they are created.
@Devin-Crawford
Copy link
Contributor Author

There should be a message written to the log when an attempt to update transparency fails.

Devin-Crawford added a commit that referenced this issue Jan 2, 2024
* Pass some proprties when creating a primitive.

Update GeometryModeler._create_object in Primitives.py
Add **kwargs as last argument to most primitive creation methods in Primitives3D

* Update unit tests and documentation.

Addressed a defect #4017 that was identified while updating unit tests.
Added documentation and updated the unit tests to allow properties of primitives to be set using arguments when they are created.

* Remove comma

A comma on the last line in a list of arguments is invalid Python 2.7 syntax.

* Update argument handling for primitives

- Address a syntax change in Maxwell 2D for primitives in Primitives2D in the plane property.
- Automate assignment of any valid property to a primitive on instantiation using kwargs.

* Update test_02_2D_modeler.py

test_09_plot() was failing because the regular polygon start and first position were along the z-axis while the polygon should have been in the XY plane.  This was also the case in the "main" branch.

* Minor cleanup of comments.

* Fix error caused by transparency.

There is a defect in the native API that leads to strange behavior when transparency of 2d objects is set.

* Fix formatting to pass IronPython test.

* Resolve style conflicts

Black changes syntax that causes IronPython failures. This was resolved using # fmt: on ... # fmt: off
@Samuelopez-ansys
Copy link
Member

@dcrawforAtAnsys Is this feature already impleted right? Please close the issue if it is.

@Devin-Crawford
Copy link
Contributor Author

This is an issue in the native API but should not come up when using PyAEDT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants