Recent

Author Topic: CAD program written in Lazarus / FPC  (Read 168499 times)

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #225 on: July 28, 2020, 12:03:13 am »
I haven't watched qcad for a long time. In a nutshell how was it then: zcad is much poorer in functions, zcad is faster, zcad is more like autocad, zcad is an unfinished program
And zcad is written in Pascal))

I'm not trying to compete, I'm not a programmer and it's a hobby. I fully understand how much more needs to be done to talk about competition
« Last Edit: July 28, 2020, 12:17:42 am by zamtmn »

VTwin

  • Hero Member
  • *****
  • Posts: 1095
  • Former Turbo Pascal 3 user
Re: CAD program written in Lazarus / FPC
« Reply #226 on: July 28, 2020, 12:21:21 am »
Very nice. Keep up the good work.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 10.13.6: Lazarus 2.2.0 (64 bit Cocoa)
macOS 12.0.1: Lazarus 2.2.0 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.0 (64 bit on VBox)

Delphi100

  • Newbie
  • Posts: 4
Re: CAD program written in Lazarus / FPC
« Reply #227 on: September 27, 2020, 09:36:07 am »
Great work!
Please support Chinese [zh_CN] Unicode DXF File  !!
Thank you very much!!!
« Last Edit: September 27, 2020, 09:39:50 am by Delphi100 »

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #228 on: September 27, 2020, 09:55:57 am »
Thanks. please attach sample
Most likely shx fonts from zcad do not contain the necessary characters

Delphi100

  • Newbie
  • Posts: 4
Re: CAD program written in Lazarus / FPC
« Reply #229 on: September 28, 2020, 03:25:59 am »
Thanks You!
Please test the attachments!

Delphi100

  • Newbie
  • Posts: 4
Re: CAD program written in Lazarus / FPC
« Reply #230 on: September 28, 2020, 04:07:54 am »
Thanks. please attach sample
Most likely shx fonts from zcad do not contain the necessary characters


The Sample DXF File use the Chinese Windows system font。

Thanks!


zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #231 on: September 28, 2020, 07:00:34 am »
Yes, I confirm that there are problems with unicode. I'll try to fix it

>>Missing details
This is a HATCH dxf primitive, is not supported yet. Will be added after some issues are resolved

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #232 on: October 17, 2020, 11:20:09 pm »
Base unicode support added.
For normal support, it remains to solve a few more"small" problems, for example https://github.com/zamtmn/zcad/issues/7

Tomash

  • Newbie
  • Posts: 2
Re: CAD program written in Lazarus / FPC
« Reply #233 on: December 17, 2020, 11:09:33 pm »
Hi All,

Good work Andrey   ;)

I try porting simplecad example to Android (LAMW). It's works, i will send pull request soon :)

I have a few questions:

1. What is it for:
GetCurrentDrawing^.pObjRoot^.ObjArray.ObjTree.maketreefrom(GetCurrentDrawing^.pObjRoot^.ObjArray, GetCurrentDrawing^.pObjRoot^.vp.BoundingBox, nil);

2. How to transform coordinates between ViewArea (Canvas) and WCS?

3. How to find entity in PTSimpleDrawing based on x, y + search radius?

And some suggestions:

1. FormatEntity should be executed only during Entity.Draw. If there is a very large drawing, after  ZoomAll, most small entities are invisible due to the small size, and full Representation is not needed. FormatEntity should be done when the user zooms to it. Of course, first time regen will be longer, but it shouldn't be noticeable. Thanks to this, we get 2 x faster reading of DXF and lower memory requirements (at least at the beginning of work with the drawing).

2. There is a problem with big coordinates, because Representation has Single type.
I changed the GDBFloat to a double and that solved the problem, but I don't know how that might affect the rest of the engine. Maybe it's better to think about some global shift instead?
I also changed to double in TZGLGeneral2DDrawer: sx, sy, tx, ty - this should be neutral.

3. One of the priorities for me is regenerating drawing in the background, not in the main thread. Then the user does not wait for everything to be drawn, but can zoom - regeneration is interrupted and restarted. Thanks to this approach, walking in the drawing is fast, regardless of the size of the drawing and even the performance of the graphics engine.
Android dislikes long operations in the main thread. There is also a big limitation - Synchronize in TThread does not work. I know how to made, but I need ability drawing in fragments or some callback function like OnRegeneratingDrawingProgress ...

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #234 on: December 18, 2020, 12:19:07 am »
Hi
>>I try porting simplecad example to Android (LAMW). It's works, i will send pull request soon
Great!

1) TEntTreeNode.MakeTreeFrom(var entitys:GDBObjEntityOpenArray;AABB:TBoundingBox;const RN:Pointer);
This build entities spatial separated index (binary tree). It used for fast entity search and draw optimizations

2) I haven't had the need for such a procedure yet, I'll add it. While you can see
procedure TGeneralViewArea.mouseunproject(X, Y: integer);
in uzglviewareageneral.pas


3)try PTSimpleDrawing^.GetCurrentROOT^.FindObjectsInVolume
see
function GDBObjGenericSubEntry.FindObjectsInVolume(const Volume:TBoundingBox;var Objects:GDBObjOpenArrayOfPV):GDBBoolean;virtual;
function GDBObjGenericSubEntry.FindObjectsInPoint(const point:GDBVertex;var Objects:GDBObjOpenArrayOfPV):GDBBoolean;virtual;
in uzeentgenericsubentry.pas

sug1
My dxf loading procedure is not optimal. Formatentity is called several times for one entity, need fix it. But calling it is necessary to correctly build spatial index (entity bounding box we can calc only after format)

sug2
Yes, the problem of large coordinates is present and I do not yet know how to solve it. The fact is that the drawings can have a very large range of coordinates. You can't work with large and small coordinates at the same time but with losing accuracy. Double instead Float only pushes the problem away, but it doesn't solve it

sug3
Drawing in a separate thread is not implemented in any way, i do not know how to multithread. But in the zcad you can set the maximum time for drawing (see render\maximum single pass time in object inspector) and then the picture will be drawn in several passes.

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #235 on: December 30, 2020, 09:16:20 am »
Hi all!
Now zcad works on Raspberry Pi

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #236 on: January 18, 2022, 08:19:45 pm »
Hi All!
Building ZCAD from sources always raises a lot of questions, so I wrote a detailed instruction with explanations https://github.com/zamtmn/zcad/blob/master/README_ENG.md Text is written for non-programmers, so there are obvious points there. My English is very bad, I will be glad if someone points out mistakes

laguna

  • Sr. Member
  • ****
  • Posts: 314
Re: CAD program written in Lazarus / FPC
« Reply #237 on: February 01, 2022, 06:35:22 pm »
Is run cad on Mac OSX?

Thanks

Handoko

  • Hero Member
  • *****
  • Posts: 4519
  • My goal: build my own game engine using Lazarus
Re: CAD program written in Lazarus / FPC
« Reply #238 on: February 01, 2022, 06:51:32 pm »
As far as I know ZCAD is only tested on Windows and Linux GTK/QT environments only. But if someone is willing to test it on OSX and report bugs, I think the developer would be glad to make it to supports OSX. Many features have been added in the recent years. I ever suggested some improvements and he adopted them.

zamtmn

  • Sr. Member
  • ****
  • Posts: 474
Re: CAD program written in Lazarus / FPC
« Reply #239 on: February 01, 2022, 07:00:31 pm »
laguna
I haven't tried it, I don't have Mac. I think that there should be no fundamental difficulties, but minor debugging will be needed

Handoko
I agree with you)) I will be glad to help

 

TinyPortal © 2005-2018