What's new

Script Error "Unable to get part for ZX-Ebene.Was it closed?"

idslk

Alibre Super User
Hello colleagues,

been playing around and got funny error.
- Open a new assembly.
- insert a random part
- start AlibreScript
- insert code in new script
- press run
- Input window for plane opens
- choose a random plane
- press ok
- the requester does not react (here on my PC)
- press the "x" in upper right window corner of input dialog
- here a funny requester pops up
Code:
Win = Windows()
ScriptName = 'Test Window'
Options = []
Options.append(['Plane1', WindowsInputTypes.Plane, None])
Values = Win.OptionsDialog(ScriptName, Options, 200)
if Values == None:
    print("Canceled... Exiting.")
    sys.exit()
print 'Values:', Values
sys.exit()
upload_2018-12-21_13-5-14.png

upload_2018-12-21_13-5-40.png

The same very little script works normaly as expected in a single part.
It's doing nearly nothing really spectacular ...
But in an assembly, it produces the funny error ...
Restartet alibre, used different parts, tried this and that, but every time the same reaction.

Is this only on my PC?

Regards
Stefan
 

oldfox

Alibre Super User
Stefan,

I get the same response as you do. So no, it isn't your PC.

Look close at the error message:

"Unable to get PART for ZX-Ebene. Was it closed?"

I have never worked directly with the API. I do know that with the regular scripts, written in TXT, the plane name has to be in English. Maybe the
the API is different.
 

idslk

Alibre Super User
Hello oldfox,
thank you for your response. I thought a little bit that it would be so.
The script itself is language independent.
The plane names are different from language to language, so the one of the german default planes in a new design is named "ZX-Ebene" the same in an english install is "ZX-Plane". The meaning is the same (and the internal name is ZXPlane for example in all languages).
In the singlepart the language dependent name is returned correcly, the error message uses the language specific words but there is and there was never a part in the assembly neither is it called or referenced in the script. On what base is the the PART context error thrown?
The script works in a single part, but not in an assembly!

Regards
Stefan
 

oldfox

Alibre Super User
The object you have to work with is either "Assembly" or "Part". If the word "Part" is used at all in the workings of the script, then that may be what
is causing the error. (I'm really not knowledgeable in the inner workings of the scripts.) Part.Getaplane for example. The plane is of the Assembly and not any one of the parts.
 

idslk

Alibre Super User
Hello oldfox,

the script is only a Alibrescript windows.optionsdialog-box, which should get a standard plane, nothing more or less.
It should not matter what it (the plane) is used for later. In the moment the dialog box should only return the plane-object.
I don't want to get a special plane in this virtual assembly (no referenceplane not in part created plane), just one of the standard planes in the "empty" (yes, it reacts same with or without a part) or "new" assembly and i don't ask alibre via script do evaluate something else. I do not use any of Part.GetPlane('Name of Plane') or Assembly.GetPlane('Name of Plane') only the windows.optionsdialog with Options.append(['Plane1', WindowsInputTypes.Plane, None]).

If i want to insert parts into this new assembly, i maybe want to use the planes to have an origin plane system to contrain to. So these standard planes are not deleteble an they are valid for all inserted parts in this assembly.
It suprises me that AlibreScript is asking about an maybe deleted part.

Regards
Stefan
 

oldfox

Alibre Super User
Well it's above me. I am still trying to learn how to use the "win" options. Sorry I couldn't help.
 

idslk

Alibre Super User
Hello oldfox,

does not really matter, it more the type of "funny" error, thank you anyway it's inspireing to "talk" with you.
Maybe somebody else knows the background for the error ...

Regards
Stefan
 

albie0803

Alibre Super User
I would say you have a part but you haven't initialised the part in scripting eg P = CurrentPart() or the Assembly for that matter. Your script doesn't know where the plane is attached.

You need to tell it about the assembly or tell it to look at the part in the assembly first.
 

idslk

Alibre Super User
Hello Albie,
hope you had a wonderful Christmas.

If you don't change the skript and try within an assembly:
- show reference geometrie and click on a reference plane, click ok, the window will be left as usual and in console it prints you an result
(the code hasen't been altered!)
- restart the skript and change nothing, Click on an assembly plane -> fail, it does not leave the input window

For me there is no chance to tell the input window something about the part or assembly, the assignment is done after the input window is left.
Then you can say my return "Values" are bound to an assembly or an part in a assembly and so on.
The input window itself is only an input window ... (yes, it does a judgment(WindowsInputTypes.Plane), is this a plane or not and shows the name if it is a plane ...)
Also take a look at https://www.alibreforum.com/forum/i...oyance-cant-find-unattached-planes-etc.20696/

Regards
Stefan
 
Top