i use qcad 3.31.2 on a windows 10
I have a script so that I get text from a selection list in the drawing.
That is this script:
Code: Select all
// Create a list of text options
var textOptions = ["Text Option 1", "Text Option 2", "Text Option 3"];
// Show a simple input dialog with a dropdown list
var selectedText = QInputDialog.getItem(
EAction.getMainWindow(), // Parent widget (Main window of QCAD)
"Select Text Option", // Title of the dialog
"Choose a text option:", // Prompt text
textOptions, // List of options
0, // Default selected index
false // Editable combo box
);
// Check if a valid option was selected (not canceled)
if (selectedText !== "") {
// Get the current document and interface
var appWin = EAction.getMainWindow();
var di = appWin.getDocumentInterface();
var doc = di.getDocument();
// Define position for the text (e.g., at coordinates 10, 10)
var position = new RVector(10, 10);
// Create text data using the selected option
var textData = new RTextData(
position, // Position of the text
position, // Alignment point
1.0, // Text height
0, // Text angle
RS.VAlignTop, // Vertical alignment
RS.HAlignLeft, // Horizontal alignment
RS.LeftToRight, // Text direction
RS.Exact, // Line spacing style
1.0, // Line spacing factor
selectedText, // Text content
"Standard", // Text font
false, // Bold
false, // Italic
0.0, // Tracking
false // Background color (disabled)
);
// Add the text entity to the document
var textEntity = new RTextEntity(doc, textData);
di.applyOperation(new RAddObjectOperation(textEntity));
}
Is there a way for qcad to automatically load this script into qcad.
or can you get it bij the Misc menu?
If I now put it in the script folder, I only see the box with the text option, but QCAD does not start.
thanks fot the help.