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.

Merge 2 Drawings - 2nd method

Started by aqua, February 22, 2007, 04:40:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aqua

Designcad 13

This macro is designed to merge 2 drawings.

This was my original method - however since it requires you to exxplode the 2nd drawing that has been loaded as a symbol, inbuilt blocks and sysmbols get exploded. The method listed in my other post avoids this issue.

It is stopping midstream.
Any clues as to why?


Regards Frank

'FTM-21/2/2007
'Old method - using load symbol - exploded blocks, groups etc
sys(470) = 1
el = sys(3)
if el = 102 then sys(3)=1
sys(3)=1

'Open current drawing - This should be done before using function
'Make sure current drawing is open
'Open existing

SYS(36)=1

layer(100)=6
layer(104)=6

sys(80)=0
>SelectLayer
{
<Layer [100]
<Layer [104]
}
If Sys(80) > 0 Then
Message "Your drawing contains an image that may be effected by the working plane rotation reset - you may need to reset the working plane and then delete and reload the image"
SYS(80)=0
END IF
>UnWorkplane
{
  }

>FitToWindow
{
  }

>Regenerate
{
}

Message "Now locate other drawing to be merged with the current drawing, then click OPEN."
>Open
{
  }





'Error - not getting past this point






'Show all layers
for i = 1 to 400
layer(0+i)=6
next i

SYS(36)=1

sys(80)=0
>SelectLayer
{
<Layer [100]
<Layer [104]
}
If Sys(80) > 0 Then
Message "Your drawing contains an image that may be effected by the working plane rotation reset - you may need to reset the working plane and then delete and reload the image"
SYS(80)=0
END IF
>UnWorkplane
{
  }

>FitToWindow
{
  }

>Regenerate
{
}

a =0
a=sys(120)
b=0
b=sys(121)
c=0
c=sys(122)
d=0
d=sys(123)

'Drawing handles for existing

>DrawingHandle
{
  <PointXYZ [a, b, 0]
  <PointXYZ [c, b, 0]
  }

'Get drawing name and file path
Fullname$ = SYS$(2)


Message "The GPS points in the just opened drawing will be moved from layer 2 to 102. Layer 102 will be hidden in the merged drawing"

sys(80)=0

layer(2)=6
>Selectlayer
{
<Layer [2]
}

for j = 1 to sys(9)    
  getattr j, type, select, layr, group, red, green, blue
if layr = 2 and select = 1 then layr = 102
  putattr j, type, select, layr, group, red, green, blue
layer(102)=0
  next
Sys(80) = 0

>Save
{
}

>Close
{
  }

>Merge
'>SymbolLoad
{
  <Filename [Fullname$]
  <PointXYZ [a, b, 0]
  <PointXYZ [c, b, 0]
  <PointXYZ [c, b, 0]
  <Type 1
  <Scale 1
  <Reference 0
  <LoadAsBlock 0
  }

layer(102)=0
>Explode
{
  }

>GroupExplode
{
  }

Sys(80)=0

>Fittowindow
{
}
sys(3)=el
sys(36)=0

prl

Quote from: aqua on February 22, 2007, 04:40:28 PM
'Error - not getting past this point

'Show all layers
for i = 1 to 400
layer(0+i)=6
next i


Didn't study your code but the item in blue is odd.  Why not layer(i) = 6

ktk

Are you tracing the progress of your macro?  I always include these 2 statements and when first running a macro I set them both to on.  This helps define problems for me.

Sys(36) = 0  '(1)Turns Off Display UpDate (0) Turns On Display
Sys(800) = 1 '(0)Turns Off Debug Trace(1) Turns On Debug Trace

Keith