Layer Colours issue - looking for a workaround

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

Moderator: andrew

Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
Post Reply
Newbie Member
Posts: 3
Joined: Thu Oct 10, 2019 7:54 am

Layer Colours issue - looking for a workaround

Post by Owen423 » Thu Oct 10, 2019 8:07 am

Hi All.

First question on this forum - we have recently bought QCAD pro to replace draftsight.

When we save a DWG from draftsight - the package that we use next in the BIM workflow correctly interprets all remaining lines on all layers as visible (ie. Black, on white, or vice-versa).
When we save a DWG from QCAD, the package that we use, correctly interprets all of the layer colours, and will not show the while lines, on a white background (they become visible when we select and area of the drawing in the package).

By experimentation, we know that the package will do this with all QCAD DWG drawing formats (its working as it should, but not how we need it to be)

So my how do I is quite simple - how do I change the line colour of all layers in (ideally) one command

so QCAD pro (current release), Windows 10 - package that is picking up the DWG files is EDSL TAS - we have confirmed its interpretation is correct with the thier support - which leaves us no option but to look for other ways to force this behaviour. My suspicion is that Draftsight isnt encoding the line colour in thier DWG format..

Save me from a headscratch.



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

Re: Layer Colours issue - looking for a workaround

Post by andrew » Thu Oct 10, 2019 8:33 am

There's an example script for that at:
Misc > Layer > Make all White Layers Black

The script can also be easily adapted to change only particular layers to desired colors, etc.

The source of that script is:

Code: Select all


 * This action changes the color of all white layers to black and can be adapted to
 * change layer colors in other ways.
function LayerWhiteToBlack(guiAction) {, guiAction);

LayerWhiteToBlack.prototype = new EAction();

LayerWhiteToBlack.prototype.beginEvent = function() {;

    var di = this.getDocumentInterface();
    var document = this.getDocument();

    var op = new RModifyObjectsOperation();

    var layerIds = document.queryAllLayers();
    for (var i=0; i<layerIds.length; i++) {
        var layerId = layerIds[i];
        var layer = document.queryLayer(layerId);

//        if (layer.getName()==="ref") {
//            layer.setColor(new RColor("blue"));
//            op.addObject(layer);
//        }
//        else if (layer.getName()==="cursor" || layer.getName()==="center") {
//            layer.setColor(new RColor("#ff0000"));
//            op.addObject(layer);
//        }
//        else if (layer.getName()==="limiting") {
//            layer.setColor(new RColor("#0000ff"));
//            op.addObject(layer);
//        }

        if (layer.getColor().name().toLowerCase()==="#ffffff") {
            layer.setColor(new RColor("#000000"));
                qsTr("Changed color of layer \"%1\" from white to black.")



 * Adds a menu for this action.
LayerWhiteToBlack.init = function(basePath) {
    var action = new RGuiAction(qsTr("Make all White Layers Black"), RMainWindowQt.getMainWindow());
    action.setScriptFile(basePath + "/LayerWhiteToBlack.js");
    action.setWidgetNames(["MiscLayerMenu", "MiscLayerToolBar", "MiscLayerToolsPanel"]);

Newbie Member
Posts: 3
Joined: Thu Oct 10, 2019 7:54 am

Re: Layer Colours issue - looking for a workaround

Post by Owen423 » Thu Oct 10, 2019 9:57 am

As we tend to remove all the unneccesary layers, this could well do the job for us, nicely!



Post Reply

Return to “QCAD 'How Do I' Questions”