What's new

AddExtrudeCut() missing attribute???

oldfox

Alibre Super User
AddExtrudeCut( name, sketch, depth, boolean) errors out with the following error:

Traceback (most recent call last):
File "<string>", line 228, in <module>
AttributeError: 'Sketch' object has no attribute 'AddExtrudeCut'

And here's the code:

**************************************************************************************
# add plane
MyPart = Part("Keyseat", False)
ZXPlane = MyPart.GetPlane('ZX-Plane')
KeyseatPlane = MyPart.AddPlane('KeyseatPlane', ZXPlane, (CylRad - Depth))

S = MyPart.AddSketch('KeyseatCut', MyPart.GetPlane('KeyseatPlane'))

# draw lines
S.AddLine(LS1X, LS1Y, LE1X, LE1Y, False)
S.AddLine(LS2X, LS2Y, LE2X, LE2Y, False)

# dwaw arcs
S.AddArcCenterStartEnd(ERC1, 0.0, ERC1, ER, ERC1, -ER, False)
S.AddArcCenterStartEnd(ERC2, 0.0, ERC2, -ER, ERC2, ER, False)

S.AddExtrudeCut('KeyseatCut', KeyseatCut, Depth, False)
*************************************************************************************
The last line (#228) is of course the culprit. I thought I had everything it needed. Obviously not.
The plane, lines and arcs work just fine. I can manually cut the sketch as desired.

Lil help please.

Thanks.
 

albie0803

Alibre Super User
You are trying to add the cut to the sketch, not to the part. As the error says.
AttributeError: 'Sketch' object has no attribute 'AddExtrudeCut'

I think it should be MyPart.AddExtrudeCut(('KeyseatCut', S, Depth, False)

Add an extrude cut to part "MyPart" called "KeyseatCut" using sketch "S" to a depth of "Depth"

I have:
# Create part
Square = Assy.AddNewPart('Hollow Section %dx%dx%dx%d' % (Height,Width,Thick,Length),0,0,0)
Slot = Square.AddSketch('Hole', Square.GetPlane('ZX-Plane'))
and
Square.AddExtrudeCut('Cut',Slot,100,False)
works for me.

Also, I like where this is heading. Please post the complete script when you are done.
 

oldfox

Alibre Super User
Albie, you flipped the light switch of understanding. Thank you, thank you, thank you.
Now I'm thinking in the right vein for "sketch" and "part". FINALLY.
It works as can be seen from the uploads. Now I just have to work out a couple more routines and it will be complete.
I run this in the console. Dialogs and dropdown selection windows are still just out of my reach. Anyone who wants to produce them,
feel free.

Still have to write the "single or double ended" and the "part open" code yet. I can do it manually easy enough but that's not good enough.

Sumpin like this??
 

Attachments

  • Work Shaft Before.AD_PRT
    511 KB · Views: 5
  • Work Shaft After.AD_PRT
    567.5 KB · Views: 4

oldfox

Alibre Super User
Teaser

Run script twice. i.e. Manual mode.
It just depends on what face numbers you enter and reference dimension. 3 variables
 

Attachments

  • Work Shaft Double Ended.AD_PRT
    625.5 KB · Views: 6

albie0803

Alibre Super User
Rather than asking for a filename

print "Enter part name in it's entirety and then press enter\n"
PartName = str(Read())
print "You entered 'Work Shaft' for part name.\n"

# def AddPlane():
MyPart = Part(PartName, False)

you can simply refer to the part you have open using
MyPart = CurrentPart()
 

oldfox

Alibre Super User
you can simply refer to the part you have open using
MyPart = CurrentPart()

Thanks for the tip Albie. That got rid of a few lines of code
Do me a favor when you get a chance and read over the "instructions" and let me know what you think, please.
 

oldfox

Alibre Super User
Here's the latest and probably the final from me for a while. But bigger and better things are coming.
 

Attachments

  • Work Shaft.AD_PRT
    623 KB · Views: 6
Top