#CustomScripts
Python Script Image + Spec Editor Crashing
Hi All, I have 2 related questions to do with Python scripts. 1. My images don't show up. I've created 32, 64, 240 and 640 px images, they're named with same (with the size as a suffix - e.g. EF_ELBOW_32.png), and they're in the same CustomScripts folder, but they don't show up anywhere. 2. When I try to create a new component in Spec Editor for one of my scripts, it crashes Spec Editor - no error messages or warnings, just gone. The script is below - it's for an Electrofusion 45deg elbow, but it was intended that the angle may change. import aqa.math import math from varmain.primitiv import * from varmain.var_basic import * from varmain.custom import * @activate( Group="Elbow", TooltipShort="EF Elbow", TooltipLong="Electrofusion Elbow", FirstPortEndtypes="PPL", LengthUnit="mm", Ports="2", ) @group("MainDimensions") @param(D=LENGTH, TooltipShort="Pipe Diameter 1") @param(D2=LENGTH, TooltipShort="Pipe Diameter 2") @param(L1=LENGTH, TooltipShort="Leg Length 1") @param(L2=LENGTH, TooltipShort="Leg Length 2") @param(R=LENGTH, TooltipShort="Elbow Radius") @param(A=LENGTH, TooltipShort="Elbow Angle") @param(S1=LENGTH, TooltipShort="Spigot Length 1") @param(S2=LENGTH, TooltipShort="Spigot Length 2") # (arxload "PnP3dACPAdapter") (testacpscript "EF_ELBOW45") def EF_ELBOW45(s, D=200, D2=200, L1=232, L2=232, R=200, A=45, S1=104, S2=104, **kw): #### NOTE: ALL ANGLES ARE CLOCKWISE. # CALCULATIONS WT1 = 6 # PIPE WALL THICKNESS WT2 = WT1 * 2 # SPIGOT WALL THICKNESS # X1=max(L1-R,S1+10) # Y1=max(L2-R,S2+10) X1 = S1 + 10 Y1 = S2 + 10 # NOTE: GEOMETRY FUNCTIONS (ARC ETC) USE ANGLES AS DEGREES, BUT TRIG FUNCTIONS USE RADS. pi = 3.xxx-xxxxxxxx Arad = A * pi / 180 T = min(L1 - X1, L2 - Y1) R2 = min(R, T * tan((pi - Arad) / 2)) # R=max(R, L1-S1+1, L2-S2+1) Lx2 = L2 * sin(pi / 2 - Arad) Ly2 = L2 * cos(pi / 2 - Arad) # EXTERNAL SHAPES ## MAIN SPIGOTS C1 = CYLINDER(s, R=D / 2 + WT2, H=X1, O=0).rotateY(90).translate((-X1, 0, 0)) C1inner = CYLINDER(s, R=D / 2, H=X1, O=0).rotateY(90).translate((-X1, 0, 0)) C2 = ( CYLINDER(s, R=D2 / 2 + WT2, H=Y1, O=0) .rotateX(-90) .rotateZ(180 + (90 - A)) .translate((-L1 - Lx2, Ly2, 0)) # - Lx2, Ly2 ) C2inner = ( CYLINDER(s, R=D2 / 2, H=Y1, O=0) .rotateX(-90) .rotateZ(180 + (90 - A)) .translate((-L1 - Lx2, Ly2, 0)) # - Lx2, Ly2 ) # ## EF LUGS C3 = CYLINDER(s, R=10, H=D / 2 + 20, O=0).translate((-S1 / 2, 0, 0)) C4 = CYLINDER(s, R=10, H=D2 / 2 + 20, O=0).translate( ( -L1 - ((L2 - S1 / 2) * sin(pi / 2 - Arad)), (L2 - S2 / 2) * cos(pi / 2 - Arad), 0, ) ) # SELF-INTERSECTING ARC DOESN'T WORK. NEED TO CREATE A TORUS THAT'S CUT. # THE PRIMARY DIAMETER/RADIUS NEEDS TO BE LESS THAN THE SECONDARY RADIUS AND THE LEG LENGTH NEEDS TO BE TO PREVENT # THE SHAPE BEING SELF-INTERSECTING. A1 = ARC3D2(s, D=D / 2 + WT1, D2=D2 / 2 + WT1, R=R2, A=A).translate((-L1, 0, 0)) A1inner = ARC3D2(s, D=D / 2, D2=D2 / 2, R=R2, A=A).translate((-L1, 0, 0)) # ARC EXTENSIONS C1a = ( CYLINDER(s, D=D / 2 + WT1, H=L1 - T - S1, O=0) .rotateY(90) .translate((-X1, 0, 0)) ) C1b = ( CYLINDER(s, D=D / 2 + WT1, H=L1 - T - S1, O=0) .rotateX(-90) .rotateZ(180 + (90 - A)) .translate((-L1 - Lx2, Ly2, 0)) ) C1aINNER = ( CYLINDER(s, D=D / 2 + WT1, H=L1 - T - S1, O=0) .rotateY(90) .translate((-X1, 0, 0)) ) C1bINNER = ( CYLINDER(s, D=D / 2 + WT1, H=L1 - T - S1, O=0) .rotateX(-90) .rotateZ(180 + (90 - A)) .translate((-L1 - Lx2, Ly2, 0)) ) C1.uniteWith(C2).uniteWith(A1).uniteWith(C3).uniteWith(C4).uniteWith(C1a).uniteWith( C1b ) C1inner.uniteWith(C2inner).uniteWith(A1inner).uniteWith(C1aINNER).uniteWith( C1bINNER ) C1.subtractFrom(C1inner) C1inner.erase() A1.erase() A1inner.erase() C2.erase() C2inner.erase() C3.erase() C4.erase() s.setPoint((0, 0, 0), (1, 0, 0)) s.setPoint((-L1 - Lx2, Ly2, 0), (-sin(pi / 2 - Arad), cos(pi / 2 - Arad), 0)) return Thanks in advance.
forums.autodesk.com
June 23, 2025 at 12:37 PM
Access hundreds of built-in and custom indicators
Perfect your edge
cutt.ly/arcZCRXm
#TradingIndicators #CustomScripts #ProTools #TechnicalSetups
May 25, 2025 at 11:14 PM
Ohh #moodle customscripts, how much do I love thee? Let me count the ways. :)
November 16, 2024 at 8:45 AM