DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Importing DWG entities with dual layers

Started by samdavo, October 29, 2013, 10:29:56 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

samdavo

Just importing from Solidworks 2D, (which can export DWG), and I find that entities imported from said DWG can have dual layers ,   eg InfoBox says the layer is  " 7     1"  with several spaces between the 7 and the 1.   This is not the same as layer 71 btw.  Nor is it the same as layers being recorded as "Multiple". 

Almost all entities have this problem, with "7   1",  or "2   3" etc (of this format anyway).
If I select an entity and run a macro to "convert selection to layer 1" (below), it balks at "GetSelect i, j" saying "out of range". (?)

(edit I don't believe it is any fault in the macro - I have trouble converting it longhand as well, because all the layers used in the imported drawing , i.e. with an asterisk, seem to be "duals" - although having said that, there are some "single" higher-number layers - like 1523 and above (from memory) - available, even if not used in the drawing at the moment.   Maybe the answer is to put the entities on those layers?).

Anyway here's that macro :-
Quote'selto1.d3m - puts selection into layer 1 with PutAttr
' including colour

max = Sys(80)

If Sys(80) < 1 Then
    Message "Nothing to do! Select something first..."
    End
End If

For i = 1 To max
    GetSelect i, j
    GetAttr j, etype, eselect, elayer, egroup, ered, egreen, eblue, esolid
   
elayer = 1
ered = 0
egreen = 0
eblue = 0
 
    PutAttr j, etype, eselect, elayer, egroup, ered, egreen, eblue, esolid

Next i
End

Anyone ever struck this?   I find it is fairly unruly to manipulate / convert to another layer.
It is difficult to post an example (today anyway) because of Proprietary info, and a simplified drawing may not have the "dual layer" problem - but I can try.    Meanwhile, someone might know what I am talking about (even if I don't lol).

And I will persevere in the background.
Cheers
sam

PS Is it possible that imported DWG files use layers higher in number than DCAD can accommodate?  And what happens in that event?

PS I was using V22.1 when I struck this problem yesterday at work.  I might try V23 later today and see what happens.

DrollTroll

Can you email me the dwg file?
Also don't confuse the layer "name" with the layer "number". In many cases they'll be one and the same, but not always.

DesignCAD 22 and 23 have a 2000-layer upper limit.
25 years with DesignCAD

samdavo

Thanks DT, - maybe 16 hours time.
ahh - maybe 7 is the layer and 1 is the name.
How bludy cunning is that lol!

DrollTroll

Well, for DesignCAD the layer NUMBER is the critical item, and the name is just the decorator; for other CAD systems, the layer name is usually the important bit, and the index is less critical.
25 years with DesignCAD

samdavo

Thanks  -
clearly you're gonna have to take your computer with you on your honeymoon, lol.  Otherwise the world as many of us know it will grind to a temporary halt till you get back.  Then again, I know what my wife would say / would have said if I tried that lol.

samdavo

I believe I have the problem nutted out.
The drawing is coming in with colours assigned to layers.
When that is cleared, it works fine.

After that, I can run either my macro which assigns colours to layers  - and dumps the rest
a) into layer 9,
b) with colour purple;

or I can run another which assigns layers to colours ( and again dumps the rest
a) into layer 9, (optional on reflection)
b) with colour purple;
 
Cheers.
Sam