Insert a descriptive picture in a macro
Hello,
I would like to know how could I insert a picture showing the parameters concerning my own macro
For exemple, if the macro draws a box, the user has to enter 3 parameters
When I execute the macro, it opens correctly, but there is no picture
For exemple, if you want to create an InfiniteBox, there is a picture showing you de dimensions you have to enter
You can even make the picture visible or invisible with the "Image" (in french version) button.
Does anyone know how to do this?
Regards!
Andres
Best Answer
-
Hi,
There is an example of macro inside there a script allows to add a picture in the macro. The macro is:
reateInitialNonMeshedCoilFor3DRadialMotor.PFM
It is available in:
C:\Program Files\Altair\2020\flux\Extensions\Macros\Macros_Flux3D_Physics\CreateInitialNonMeshedCoilFor3DRadialMotor.PFM
The part of the scrip is :
if isActif ==False:
INSTALL = os.environ["INSTALLFLUX"]+ os.path.sep + ".."
image_filename = INSTALL+os.path.sep+"Extensions"+os.path.sep+"Macros"+os.path.sep+"Macros_Flux3D_Physics"+os.path.sep+"CreateInitialNonMeshedCoilFor3DRadialMotor.PFM"+os.path.sep+ "CreateInitialNonMeshedCoilFor3DRadialMotor.jpg"
print image_filename
image = imageio.ImageIO.read(io.File(image_filename))
frame = JFrame('DATA Description',
defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE,
size = (1290,870))
label = JLabel(ImageIcon(image))
label.setHorizontalAlignment(JLabel.RIGHT);
label.setVerticalAlignment(JLabel.BOTTOM);
frame.add(label)
frame.setAlwaysOnTop(True)
frame.visible = True
Best regards.
0
Answers
-
Hi,
There is an example of macro inside there a script allows to add a picture in the macro. The macro is:
reateInitialNonMeshedCoilFor3DRadialMotor.PFM
It is available in:
C:\Program Files\Altair\2020\flux\Extensions\Macros\Macros_Flux3D_Physics\CreateInitialNonMeshedCoilFor3DRadialMotor.PFM
The part of the scrip is :
if isActif ==False:
INSTALL = os.environ["INSTALLFLUX"]+ os.path.sep + ".."
image_filename = INSTALL+os.path.sep+"Extensions"+os.path.sep+"Macros"+os.path.sep+"Macros_Flux3D_Physics"+os.path.sep+"CreateInitialNonMeshedCoilFor3DRadialMotor.PFM"+os.path.sep+ "CreateInitialNonMeshedCoilFor3DRadialMotor.jpg"
print image_filename
image = imageio.ImageIO.read(io.File(image_filename))
frame = JFrame('DATA Description',
defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE,
size = (1290,870))
label = JLabel(ImageIcon(image))
label.setHorizontalAlignment(JLabel.RIGHT);
label.setVerticalAlignment(JLabel.BOTTOM);
frame.add(label)
frame.setAlwaysOnTop(True)
frame.visible = True
Best regards.
0 -
Hello,
It works fine.
It is not exactly like in the InfineBox example. The picture appears in a separate window. But it is actually still better like this
Thank you very much!!
Regards!
Andres
0 -
You are welcome.
Best regards.
0