What's new

AddExtrudeBoss is erroring out.

oldfox

Alibre Super User
I'm still confused when I read "Help". I'm missing something in the AddExtrudeBoss script syntax.

Here is the code snippet:

# Create part
Nut = Part("%sBA Hex Nut" % (SI[Choice]))
print "\nYou have specified a %sBA Hex Nut" % SI[Choice]

# hex nut
HexNut = Nut.AddSketch("Nut", Nut.GetPlane("XY-Plane"))
HexNut.AddPolygon(0, 0, HexAcrossFlats, 6, False)
HexNut.AddExtrudeBoss("Hex Nut", Nut, Thickness, True)

The last line is the one causing the error I think. I can comment it out and the error doesn't raise it's ugly head again.

And here is the error:

You have specified a 3xx Hex Nut
System.MissingMemberException: 'Sketch' object has no attribute 'AddExtrudeBoss'
at IronPython.Runtime.Binding.PythonGetMemberBinder.FastErrorGet`1.GetError(CallSite site, TSelfType target, CodeContext context)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
at AlibreScript.UI.IronTextBoxControl.#ijb(Object #9A)
>>>

What I need here is the "silver bullet". All help is appreciated. Thanks.
 

idslk

Alibre Super User
Hello oldfox,

the error says: 'Sketch' object has no attribute 'AddExtrudeBoss'.
If you want to create a feature, you need :
Part.AddExtrudeBoss ( Name, Sketch, Depth, IsReversed )
That means in your example:
Nut.AddExtrudeBoss('HexNut,HexNut,Thickness,True)
because you have defined: Nut = Part and HexNut = Sketch

If you change "XY-Plane" against 'Nut.XYPlane' in your
HexNut = Nut.AddSketch("Nut", Nut.GetPlane("XY-Plane")),
it will be language independent.;)

Regards
Stefan
 

oldfox

Alibre Super User
because you have defined: Nut = Part and HexNut = Sketch
And that's where I go wrong. Albie explained it earlier also (now i remember it). It's just one of those things that's not sinking in.

If you change "XY-Plane" against 'Nut.XYPlane'
Does mean that it will be using the "Nut" reference planes?

And thanks for that "silver bullet". Just what I needed at this point. (picking up hair off of the floor):oops:
 

idslk

Alibre Super User
Hello oldfox,
glad i could help you.
Part 2, principaly yes and it's nearly the same as you've used.
The only difference is Part.XYPlane (or Part.YZPlane or Part.ZXPlane) will be understood in every installation language (The same is valid for axis, see reference manual).
so your line: HexNut = Nut.AddSketch("Nut", Nut.GetPlane("XY-Plane")),
independent: HexNut = NutAddSketch("Nut", Nut.XYPlane)
Regards
Stefan
 

oldfox

Alibre Super User
Thanks Stefan. Makes sense now. Just hope it sticks for a while. It's only in the scripts that I really stumble. Usually I can do fair just using AD without scripts.
 
Top