Forum dedicated to drawing translation issues.
#27024 by rayq
Tue Aug 14, 2007 1:07 pm
Hi, I need some help about the Insert & Block definition in DXF version 13 and below. I have the following info:

Insert:

0
INSERT
2
BDRY
8
WELLS
62
0
10
373668
20
6042234
41
0.3
42
0.3
:
:
:

Block:

2
BDRY
8
BLKLAYER
10
347699
20
6070329
70
64
0
CIRCLE
8
BLKLAYER
62
7
10
347700
20
6070330
40
0.750
:
:


As my understanding, for the final placement point I will take the insertion point in the INSERT, then add it to the point (origin of the circle in my example) * the scale.

x = 373668 + 347700 * 0.3
y = 6042234 + 6070330 * 0.3

Is this correct? What are x (347699) & y (6070329) values right at the beginning of the BLOCK for?

Any input is greatly appreciated. Thanks.
#27025 by devinder
Tue Aug 14, 2007 1:24 pm
Those co-ordinates are block base point. Block entites will be first translated using the base point first. Thus circle would be drawn at:
x = 373668 + (347700-347699) * 0.3
y = 6042234 + (6070330-6070329) * 0.3
#27029 by rayq
Tue Aug 14, 2007 2:53 pm
Thanks devinder, that solves the problem :D .
#38702 by wwinthan
Thu Aug 14, 2008 11:37 am
I have a software that needs to process dxf files and I am having a
nightmare trying to find the absolute corrdinates of LINEs inside
blocks.

This is what I know about BLOCKS:

Each BLOCK (in the BLOCKS section) has a block name that is related to
an INSERT entity (In the ENTITIES section).
The INSERT entity defines the transformation parameters such as origin,
scale and rotation, to transform the BLOCK coordinates from relative to
absolute coordinates.
All coordinates in the BLOCK may be transformed using the parameters
defined in INSERT.
Each BLOCK ends with ENDBLK.

This is what I need to do:

I need to transform the relative coordinates of LINEs inside blocks (in
the BLOCKS section) to absolute coordinates.
What I do is search (using the block name) the corresponding INSERT
entity (in the ENTITIES section) which gives me the coordinates of the
block, so by adding the relative + block corrdinates I can obtain the
absolute coordinates for LINEs.

SO FAR THE EXPLANATION, NOW THE PROBLEM TO SOLVE:

What can I do if I find more than one INSERT entity with the same block
name ?
How do I know which one applies to each LINE, since for a given block
name there is only one BLOCK structure in the blocks SECTION but in
some cases there is more than one INSERT entity in the ENTITIES
section


I tried following but doesn't work. the following are dxf file opened in notepad.
/////////////////////////
//////////////////////////

BLOCKBLOCKBLOCKBLOCKBLOCK
5
62
330
4A
100
AcDbEntity
8
0
100
AcDbBlockBegin
2
CK_HATCH_0319
70
0
71
0
10 <<base point of block(x)
0.0
20 <<base point of block(y)
0.0
30
0.0
3
CK_HATCH_0319
1

0
LINE
5
4B
330
4A
100
AcDbEntity
8
Unnamed [40]
6
Continuous
62
4
48
2.0
370
0
100
AcDbLine
10
-0.5967346429824829 <<line (relative coordinate in block: x1)
20
-2.942419290542603 <<line (relative coordinate in block: y1)
30
0.0
11
-0.4835976660251617 <<line (relative coordinate in block: x2)
21
-2.942419290542603 <<line (relative coordinate in block: y2)
31
0.0
/////////////////////////////////////////
INSERT INSERT INSERT INSERT
/////////////////////////////////////////
INSERT INSERT INSERT INSERT

5
476
330
471
100
AcDbEntity
8
Unnamed [20]
62
2
370
-2
100
AcDbBlockReference
2
_CLOSED
10
-4.805948448181153 << Insert x value
20
-0.1038970574736592 <<Insert y value(related to block_
30
0.0
41
0.125 <<Insert x scale factor
42
0.125 <<Insert y scale factor
43
0.125
////////////////////////////////////////////////////////////
Here goes question
-------------------------
Your solution doesn't work!!!!!!!!!
Those co-ordinates are block base point. Block entites will be first translated using the base point first. Thus line would be drawn at:
line (relative coordinate in block: x1) = Insert x+ (line {relative coordinate in block: x1}-basepoint{block}) * Insert x scale factor
line (relative coordinate in block: x2) = Insert y+ (line {relative coordinate in block: y1}-basepoint{block}) * Insert y scale factor

------------------------------------------------------------------------------

Who is online

Users browsing this forum: No registered users and 6 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984