Recent

Author Topic: DXF translation of aligned dimlines in FPvectorial  (Read 17134 times)

eraaijma

  • New Member
  • *
  • Posts: 26
DXF translation of aligned dimlines in FPvectorial
« on: September 07, 2015, 10:54:36 pm »
The FPvectorial package has some translation-problems with aligned dimensions. I have tried to change this.

Attached I have posted the original DXF file and the changed programs of fpvectorial
If you look at the DXF files with the original fpvectorial and with the new files, you will see some improvements.

I am not a great programmer though and I have a question:
In the header of the DXF files I find:
(9 $DIMSCALE)
(40 200.0)
I would like to get that dimscale accross from dxfvectorialreader to fpvectorial and I have absolutely no clue how to do that.
Can someone help me please?



zamtmn

  • Hero Member
  • *****
  • Posts: 593
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #1 on: September 08, 2015, 12:04:14 am »
>>I would like to get that dimscale accross from dxfvectorialreader to fpvectorial and I have absolutely no clue how to do that.
This requiressupport of dxf dim styles (and maybe dim  styles overriders) and access to them from dim entities code. I understand this is not yet implemented in fpvectorial
Probably because fpvectorial multi-format library, so deep support one dxf format is not done.

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #2 on: September 08, 2015, 09:22:45 am »
Having no dimscale feels like printing a magazine or paper without a variable for 'font.size'.

Representing dimensions in the correct way might need a lot more then only the dimscale command. F.i. maybe the the sizes of arrows is a multiplication of a base size * one of the defined scales.

Looking at the dxf vectorialreader-unit, the implementation starts off with defining which autocad versions has been used.
- I went through this list and exported from Autocad to the various versions.
- I even exported from Autocad to a PDF, imported this in Adobe Illustrator and exported it again to a DXF format.
As far as I could check, there is always a record for dimscale in a DXF file. This looks to be generic instead of 'one dxf format'

That's why I still want to discuss what the best way would be to get data across from dxfvectorialreader fo fpvectorial.

Maybe, we would need to make a dynamic array (of records) in dxfvectorialreader. In that way I could expand it when we go along and understand more of how every entry influences the drawing.

If then I get data in fpvectorial.pas, I could analyse the data there and use the correct entries for each of the dims.

Example
record 1: DIMSCALE, ISO001, dimscale 1, ..., ....
record 2: DIMSCALE, ISO010, dimscale 10, ...., ....
record 3: DIMSCALE, ISO015, dimscale 15, ...., ....
record 4: DIMSCALE, ISO0XY, dimscale 50, ...., ....
record ?: DIMASZ, 0.16, ...., ....
record ?: DIMEXO, 0.0625, ...., ....

If the Array does not exist, is nil, or has no relevant entry, defaults (constants) could be used.


zamtmn

  • Hero Member
  • *****
  • Posts: 593
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #3 on: September 08, 2015, 12:45:17 pm »
As far as I found out in the header variables contains copies of the values from the current dimension style, or their current overriders.
In my implementation I did support dimension styles, while not all, but gradually moving in that direction. Even having it to organize behavior like in autocad is difficult - different combinations are treated differently and it's nowhere documented, there are only general descriptions.
I attach a screenshot of how your drawing looks in fpvectorial (with your changes), in autocad, in my program: http://storage2.static.itmages.ru/i/15/0908/h_1441709034_9560598_ec28ef8989.png

Also I noticed that after your changes size of the texts has increased and now is not always included in the space provided

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #4 on: September 08, 2015, 02:40:10 pm »
@zamtmn
The representation in your program looks splendid. I have tried to study zcad program files, but it is way out of my league.

So far I have tried to implement some trigonometry into fpvectorial, and the result is starting to show bit by bit.
I still have to work on circular dimensions, angular dimensions and leaders.

After that I would like to work on:
- representation of text
- projections of circles (isometric views).

Once that is all done, the program should work fine for me.
Thanks anyway

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #5 on: September 08, 2015, 04:52:33 pm »
Hello, could you send changes to fpvectorial as diff files? Instructions here: http://wiki.freepascal.org/Creating_A_Patch

thanks,

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #6 on: September 08, 2015, 04:52:55 pm »
Also it should be in a BTS ticket...

zamtmn

  • Hero Member
  • *****
  • Posts: 593
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #7 on: September 08, 2015, 09:46:34 pm »
@felipemdc
I attach changes from eraaijma in diff format

@eraaijma
Get DIMSCALE inside TvDXFVectorialReader very simple, look TvDXFVectorialReader.ReadHEADER. The problem is how to convey this in TvVectorialDocument, felipemdc should tell how to do it correctly. I think in FpVectorial selected the wrong architecture, TvVectorialDocument this general class and it should not contain specific data of a specific format (although why it already contains DXF specific primitives). It is more correct to add TvDXFVectorialDocument with all the necessary styles and variables




eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #8 on: October 07, 2015, 07:08:26 pm »
I have made some changes to DXFreader,FPVectorial and FPvUtils

There is good news and bad news
Bad news:  I don't know if this code is compatible with other parts of the package
Good news: I get a better presentation of my DXF files
> Generic:
- program now refuses to show dimension, if error occurres. What it presents is more reliable.
> Dimtext:
-function added to attach text left,centre,right, up middle and below attachment point
-function added to rotate all angles and flip when upside down
-function added to show manual overrides in drawings
> Arrows
- functions added to change appearence (polygon, polyline, pointed, straight)
- functions added to point them in all directions
> Linear dimensions:
- Horizontal, vertical, aligned and rotated seem to be working now
> Arc Dimensions
- extension lines corrected
- nice arc following arrows and tails
> Radial and Circulair dimensions
- extension lines corrected

I will hereafter attach the files, to see the difference, just swap them with the ones in 'components'.

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #9 on: October 07, 2015, 07:09:14 pm »
Here is dxf example 1

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #10 on: October 07, 2015, 07:09:36 pm »
Here is dxf example 2

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #11 on: October 07, 2015, 07:10:03 pm »
here is dxf example 3

eraaijma

  • New Member
  • *
  • Posts: 26
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #12 on: October 07, 2015, 07:10:27 pm »
here is dxf example 4

zamtmn

  • Hero Member
  • *****
  • Posts: 593
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #13 on: October 07, 2015, 11:09:53 pm »
eraaijma
It looks very good, but a few remarks:
- Sample files contain a lot of unnecessary information (mainly block definitions), so they are so big and are processed slowly in fpvviewer
- Drawing is visible only if set "force white background" checkbox
- Instead of drawing the white square under the text would be better to calculate the intersection of the scope of the text and the dimension line\arc, and draw two lines\arcs do not fall under the dim text
- Your diff files have a strange format
« Last Edit: October 07, 2015, 11:11:28 pm by zamtmn »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: DXF translation of aligned dimlines in FPvectorial
« Reply #14 on: October 09, 2015, 04:01:46 pm »
The changes to fpvectorial.pas are based on an older version of the code.

Also there are a lot of identation changes which make it harder to read. And the patch in general is huge... I wonder if I should just apply it ... because I don't have enough time to deeply look into it.

 

TinyPortal © 2005-2018