create a parameterised drawing (script) off command line

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
schkip
Registered Member
Posts: 1
Joined: Thu May 14, 2015 8:13 am

create a parameterised drawing (script) off command line

Post by schkip » Fri May 15, 2015 8:12 am

Hi All,

Firstly thanks for your help.
I need to create a drawing but I suspect the locations, sizes, dimensions, existence of some of the drawing entities for this drawing instance will change.
I could draw it all in via the command line, but another way stuck me that might be more flexible.
Could I create a script which is sent to the command line which allows for variables to be initialised (eg size of rectangles and their locations) and these variables are then sent to the function call for the rectangle.
This way I can change the values for the variables if something changes and draw up the drawing based on a rerun of the script (rather than type everything in again).

I have looked at some existing posts on the scripting API and creation of Javascript (eg. the famous spiral) but I think what I'm after is slightly different ie. I don't need it to be part of a library as it is a very specifc drawing rather than an add-on module or part which is generic.

Can anyone point me in the right direction please?

Thanks
skipper

build and O/S info:
>>>>
Version: 3.9.1.0 (3.9.1)
Build Date: Mar 13 2015
Qt Version: 4.7.4
Compiler: MSVC++ 10.0 (2010)
O/S: windows 7 enterprise
>>>>>

User avatar
andrew
Site Admin
Posts: 9061
Joined: Fri Mar 30, 2007 6:07 am

Re: create a parameterised drawing (script) off command line

Post by andrew » Fri May 15, 2015 4:34 pm

The spiral script would be the right approach for this. Note that this script is not meant for the library browser but rather creates a menu to insert a spiral:
https://raw.githubusercontent.com/qcad/ ... hSpiral.js

Alternatively, you could load a drawing and modify it (for example using stretch, move, rotate, etc).

It depends a bit how much of the drawing is parametrized.

Post Reply

Return to “QCAD 'How Do I' Questions”