What's new

AlibreScript Code Assistant - Custom GPT

stepalibre

Alibre Super User
For anyone using AI to help write Alibre Script or AlibreX Python code, my Alibre Python Shell addon may be of interest to you. The Alibre Python Shell is what I use to quickly test IronPython and Alibre API code, which obviously includes AI-generated code.

References:
 

stepalibre

Alibre Super User
I noticed 5k chats counted for one of my GPTs. It's unclear how OpenAI counts conversations, unique chat sessions, or if each user is only counted once (for the first chat). Is anyone using it for AD?

1727324885658.png


edit: I removed all references to AlibreScript.
 
Last edited:

stepalibre

Alibre Super User
Gen AI is on fire!
1733246278515.png
Python:
from AlibreScript import *

def create_base_plate_with_holes(hole_count):
    # Initialize a part session
    part = CurrentPart()

    # Define dimensions for the base plate and holes
    plate_length = 100.0  # Length of the base plate
    plate_width = 50.0    # Width of the base plate
    plate_thickness = 5.0 # Thickness of the base plate
    hole_diameter = 5.0   # Diameter of the holes
    hole_offset = 10.0    # Offset of the holes from the edges

    # Create a base plate
    base_sketch = part.AddSketch('BasePlateSketch', part.XYPlane)
    base_sketch.AddRectangle(-plate_width / 2, -plate_length / 2, plate_width / 2, plate_length / 2, False)
    part.AddExtrudeBoss('BasePlate', base_sketch, plate_thickness, False, part.EndCondition.ToDepth, None, 0, part.DirectionType.Normal, None, 0, False)

    # Create holes based on hole_count
    hole_positions = []
    if hole_count == 2:
        hole_positions = [
            (-plate_width / 2 + hole_offset, 0),
            (plate_width / 2 - hole_offset, 0)
        ]
    elif hole_count == 4:
        hole_positions = [
            (-plate_width / 2 + hole_offset, -plate_length / 2 + hole_offset),
            (plate_width / 2 - hole_offset, -plate_length / 2 + hole_offset),
            (-plate_width / 2 + hole_offset, plate_length / 2 - hole_offset),
            (plate_width / 2 - hole_offset, plate_length / 2 - hole_offset)
        ]
    elif hole_count == 6:
        hole_positions = [
            (-plate_width / 2 + hole_offset, -plate_length / 2 + hole_offset),
            (plate_width / 2 - hole_offset, -plate_length / 2 + hole_offset),
            (-plate_width / 2 + hole_offset, plate_length / 2 - hole_offset),
            (plate_width / 2 - hole_offset, plate_length / 2 - hole_offset),
            (0, -plate_length / 2 + hole_offset),
            (0, plate_length / 2 - hole_offset)
        ]

    for (x, y) in hole_positions:
        hole_sketch = part.AddSketch('HoleSketch', part.XYPlane)
        hole_sketch.AddCircle(x, y, hole_diameter / 2, False)
        part.AddExtrudeCut('ThroughHole', hole_sketch, 0, False, part.EndCondition.ThroughAll, None, 0, part.DirectionType.Normal, None, 0, False)

    # Save the part
    #part.Save()

# Run the function to create a base plate with a specified number of holes
# Example usage with hardcoded sample sizes
create_base_plate_with_holes(4)  # Change to 2, 4, or 6 as needed
 
Top