include debugging = false; /** * Quote * * @param offsetFromOrigin - It specifies the distance from the object being dimensioned to the start of the extension lines * @param extendBeyondDimLines - How much the extension lines extend past the dimension line * @param textOffset - Distance between dimension text and dimension line * @param direction - Direction of the dimension line (RIGHT, LEFT, UP, DOWN) * @param placement - If BOTTOM, places the dimension below the model; if TOP, above (default is TOP) */ module quote( length, offsetFromOrigin = 140, extendBeyondDimLines = 40, textOffset = 10, direction = RIGHT, color = "Red", placement = TOP ){ // Determine rotation angle based on direction angle = direction == RIGHT ? 0 : direction == LEFT ? 180 : direction == UP ? 90 : direction == DOWN ? -90 : 0; // Adjust offset based on whether the dimension is under the model actualOffset = placement == BOTTOM ? -offsetFromOrigin : offsetFromOrigin; // Use color color(color) { // Rotate everything according to the direction zrot(angle) { path = [[ 0, actualOffset], [length-5 , actualOffset ]]; // Paralel line stroke(path, width = 3,endcaps = "arrow2",endcap_width = 15); // Extension Line 1 ext1 = [[0,0], [0,actualOffset + (placement == BOTTOM ? -extendBeyondDimLines : extendBeyondDimLines)]]; stroke(ext1, width=3); // Extension Line 2 ext2 = [[length,0], [length,actualOffset + (placement == BOTTOM ? -extendBeyondDimLines : extendBeyondDimLines)]]; stroke(ext2, width=3); // Text back( actualOffset + textOffset ) right(length/2) text(str(length), size=60, font="Saira Stencil One", halign="center"); } } } if ( debugging ) quote(1000,direction=RIGHT,placement=BOTTOM);