News:

Please note new Forum URL: forum.designcad.com

Main Menu

Merge 2 drawings

Started by aqua, December 10, 2006, 02:32:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

aqua

Designcad 13

I want to merge 2 existing drawings.
Open drawing is called Current, other drawing is called Existing.
Want to merge the Existing drawing into the current one
Can this be done without setting any points
i.e.

'Open current drawing
'Task- Merge an existing drawing into current
'User would then find existing drawing
'Make sure existing not the same name as current
'It brings existing drawing straight in
'Positions it correctly i.e. using existing x & y from existing and places it in the same position in the current drawing
'Merge into existing drawing
'Puts existing drawings items on their same layer in current drawing
(i.e. if an item is on layer 5 in existing, then it would go on layer 5 in current)
'Does not rename layer names unless current layer name is blank
'Shows/hides current layers as per existing drawing except if layer is also used in current - current status would apply.

Regards FM

DrollTroll

Hi Frank,

The only way I could see right now (in any existing version) would be through a somewhat complex macro:
1) Pre-load Existing by itself
2) Extract Existing's drawing handles
3) Extract names and status of all layers in Existing
4) Close Existing
5) Merge Existing into Current setting one point at Existing's primary drawing handle location
6) Update layers as needed

Why don't you submit this as a feature request? It could be another command, or more options on Symbol Load.

I wouldn't be too terribly surprised of one of our macro geniuses already has a macro for this, or whips one up in short order. (If you guys do, remember our User Submissions section in the SDK area...)


25 years with DesignCAD

prl

#2
The whole issue of merging whether by loading or by clipboard touches upon the issue of layer names versus layer indexes. It is more complex than one realizes and should probably be discussed first just in general terms so that some expected behaviors are agreed upon.

To use an example, lets say the current active drawing has the following layers:

1 - interior wall
3 - exterior wall
5 - window
7 - (unnamed layer with entities on them)
11 - door


The second drawing has the following layers:

1 - exterior wall
3 - beams
5 - special openings
7 - door
11 - (unnamed layer with entities on them)
15 - interior wall

So if we merge the second drawing to the first, what would you expect?  Here's what I see so far:

Base requirement - I would enforce that no layer with entities on them can be unnamed.  If the user doesn't name them, the layer is automatically given the string name equal to the index number.  In the above, layer 7 would be called 7.  Similarly in the second drawing, layer 11 would be called 11.

With all layers having a string name, there are two cases that I see for merging:

Case I:  A layer name exists in the second drawing that exists in the active drawing.

DesignCAD action - the second drawing has the entities tagged for moving to the same layer name in the active drawing when merged.


Case II:  A layer name in the second drawing does not exist in the active drawing.

DesignCAD action - see if the index number is available (unused) in the active drawing.

If available, simply merge keeping the same index number and assign the layer name from the second drawing to the active drawing.

If already used, scan for lowest available (empty) layer index and merge entities and layer name to that level.

Using this criteria, the second drawing would be reorganized in memory space to look like this:

3 - exterior wall
2 - beams
4 - special openings
11 - door
6 - 11
1 - interior wall

when inserted into the active drawing we would get this merge

1 - interior wall
2 - beams
3 - exterior wall
4 - special openings
5 - window
6 - 11
7 - 7
11 - door


Anyone see any other combinations that need to be addressed?  Any thoughts?



 




aqua

I have created a macro that will merge 2 drawings.

Note: We have default layer names for all drawings from layer 100 upwards.
Layer names in the first 20 layers may differ if the original data was sourced externally - e.g from a surveyor as a dxf

This macro does no rename any existing layer

Show/Hide status from current drawing is not changed
i.e if the merged drawing had hidden layers but the current layer status is show - then they will be shown






'FTM-11/12/2006
sys(470) = 1
el = sys(3)
sys(3)=1
'Open current drawing - This should be done before using function
'Make sure current drawing is open
'Open existing

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

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)

>Close
{
  }

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

  }
>Explode
{
  }
>GroupExplode
{
  }
Sys(80)=0

>Fittowindow
{
}
sys(3)=el
End

bdeck

Hello Prl,

Good points on layer conflict resolution.

Aside from layer conflicts, it seems to me the 3 other basic requirements would be drawing alignment, discrimination, and ovelap resolution.

Alignment: If these two files are different versions of the same drawing, they may share the same origin. If not, the software will have to be brainy, or the user will have to set a point or two. I vote against putting the brains in the software. (this could tie up a developer forever) Perhaps the merge utility could show the origins in adjacent windows prior to merge.

Discrimination: A helpful utility for version management would flag each difference between two drawing files, using color. Sometimes all that is needed for a merge is to identify the differences and flag them so the user can cut and paste between files. This is not trivial, but doable.

Overlap resolution: This feature, which could probably be done well in a macro, could be helpful in many situations, not limited to merge.  A function could  scan a drawing and flag any overlapping entities (identical or not), displaying them in such as way as  to allow the user to identify which ones to keep and which to delete.

After a slew of editing, I occasionally find multiple arcs or lines of different lengths sharing the same space. These could be on the same or different layers. Before exporting the file to a cnc machine which may or may not have the ability to resolve these overlaps, I go through the entire drawing looking for the needle in a stack of needles. Using line connect helps in the process. Has anyone already written a macro to do this?

These look like separate functions to me. File compare and overlap resolution are useful enough to be free standing functions.

Set origin already exists.

Perhaps a new parameter to the "load symbol" command to load by origin, and another to use named layers  could be used in a macro to accomplish merge in a single command.

BD

PS. What about DC Options. Would we want options from the existing file to import to the current drawing? What if the current drawing is a blank sheet? Should "load options" be another parameter to the load symbol command?