Lazarus

Announcements => Third party => Topic started by: zamtmn on April 18, 2012, 09:43:04 am

Title: CAD program written in Lazarus / FPC
Post by: zamtmn on April 18, 2012, 09:43:04 am
Hi all,

Source: https://github.com/zamtmn/zcad (need Lazarus 2.2 (or trunk) and 3.2 (or trunk) FPC to compile)
Binaries: https://github.com/zamtmn/zcad/releases
Nightly builds https://ci.appveyor.com/project/zamtmn/zcad (win32)
Build from source https://github.com/zamtmn/zcad/blob/master/README_ENG.md
License: mLGPLv2 dual: gpl3/mpl2

Features:
-Fast OpenGL rendering
-Fast GDI rendering
-Crossplatform (Windows x86/x64, Linux x86/x64 - gtk/qt)
-DXF fileformat
-SHX, TTF font support
-true DXF linetypes
-POINT, LINE, CIRCLE, POLYLINE,  LWPOLYLINE, ARC, ELLIPSE, INSERT, TEXT, MTEXT, 3DFACE, SOLID, SPLINE, HATCH entities support
-Polar tracking, Object snap

ToDo:
-Dimensional entities (partially done)
-Hatch entity (partially done)
-Line type
-More entities
-Separate graphics engine from the CAD implementation(partially done)
-GDI and canvas render backends
-DX render backend
-Printing
Title: Re: CAD program written in Lazarus / FPC
Post by: fredbrastux on April 18, 2012, 01:01:50 pm
Nice Work !
Title: Re: CAD program written in Lazarus / FPC
Post by: LA.Center on April 25, 2012, 12:27:59 pm
super! well done.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 26, 2012, 09:45:21 am
@plusplus, @fredbrastux
Thanks. I am not programmer, but an engineer. Therefore the program looks useful, but the source code is very bad
Title: Re: CAD program written in Lazarus / FPC
Post by: JD on April 26, 2012, 10:37:43 am
Very good! I'm impressed. It's nice to see Lazarus/FPC being used for such "heavy" projects. It shows how versatile Lazarus/FPC is and it will surely spread the word about its capabilities.
Title: Re: CAD program written in Lazarus / FPC
Post by: nicke85 on April 27, 2012, 12:05:28 pm
Amazing stuff in Lazarus/FPC. Excellent work!  :)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 12, 2012, 09:05:59 am
If someone has ideas, suggestions or remarks about ZCAD, please let me know. I implemented everything for my needs, the development process slowed.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 30, 2012, 10:15:34 am
Soon I want to implement support DWG format for reading. Based on LIbreDWG source and ODA specifications
Title: Re: CAD program written in Lazarus / FPC
Post by: exdatis on June 30, 2012, 02:08:09 pm
   Great job!  ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: fredycc on July 01, 2012, 02:21:58 am
 :) Wow, great work

Regards
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 04, 2012, 08:18:24 am
Thanks.

I got decrypt file dwg2004 and have access to entities. Simple lines import from dwg now works.
Title: Re: CAD program written in Lazarus / FPC
Post by: bp on July 06, 2012, 12:49:59 pm
 Good work Andrey. Actually, I'll doubt your statement "I'm not a programmer", because a lot of code has been written and it works.

(minor nit: drag a separator line in the objectinspector to the left, outside of program window, and you'll not be able to get it back...)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 06, 2012, 02:15:56 pm
Thanks.
>>minor nit: drag a separator line in the objectinspector to the left, outside of program window, and you'll not be able to get it back...
This lack of Anchordocking package. Unfortunately so far this package a lot of bugs and limitations ((
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 08, 2012, 11:42:55 am
I added to sources a simple program (cad_source\simplecad\simplecad.lpr) to show how you can use vector editor in your application. Though it is difficult, but I want to fix it.
Title: Re: CAD program written in Lazarus / FPC
Post by: BlueIcaro on July 21, 2012, 10:30:59 pm
Hi, I downloaded the source code (svn revison 250), and I tried to compile it, but I got the following error:
Quote
gui\oglwindow.pas(4518,221) Error: Incompatible types: got "OGLSPECFUNC.TViewPortArray" expected "GLU.TViewPortArray"

I tried to compile under Lazarus 1.1 SVN 37964 FPC 2.6

Any idea?

/BlueIcaro
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 22, 2012, 11:10:25 am
Сomment line 29
Code: [Select]
{glu}TViewPortArray = array [0..3] of GLint;in misc\OGLSpecFunc.pas
In the FPC 2.6, this type is defined in glu.pp

It is also possible there will be errors:
Quote
GDBCommandsBase.pas(741,13) Error: identifier idents no member "AuxBuffers"
GDBCommandsBase.pas(742,13) Error: identifier idents no member "StencilBits"
GDBCommandsBase.pas(744,13) Error: identifier idents no member "DepthBits"
Comment out the line causing them to
Title: Re: CAD program written in Lazarus / FPC
Post by: BlueIcaro on July 22, 2012, 05:31:23 pm
Сomment line 29
Code: [Select]
{glu}TViewPortArray = array [0..3] of GLint;in misc\OGLSpecFunc.pas
In the FPC 2.6, this type is defined in glu.pp


Thanks for the help. But Now I have a error, with DefaultSystemCodePage in Zcad file, this lines:
Code: Pascal  [Select][+][-]
  1.                               programlog.logoutstr('DefaultSystemCodePage:='+inttostr(DefaultSystemCodePage),0);
  2.                              programlog.logoutstr('DefaultUnicodeCodePage:='+inttostr(DefaultUnicodeCodePage),0);  
  3.                              programlog.logoutstr('UTF8CompareLocale:='+inttostr(UTF8CompareLocale),0);    
  4.  
The errors are:
Quote
zcad.pas(101,107) Error: Identifier not found "DefaultSystemCodePage"
zcad.pas(102,109) Error: Identifier not found "DefaultUnicodeCodePage"
zcad.pas(103,99) Error: Identifier not found "UTF8CompareLocale"

/BlueIcaro




Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 22, 2012, 05:49:35 pm
This from fpc 2.7.1, comment out these lines
Title: Re: CAD program written in Lazarus / FPC
Post by: BlueIcaro on July 22, 2012, 07:44:19 pm
This from fpc 2.7.1, comment out these lines
Thanks, I did it, and now I can compile the source. I going to explore your code, because I found it very interesting, the use that makes of OpenGl and import of cad files.

/BlueIcaro
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 09, 2012, 09:52:08 pm
I fixed a compilation in fpc 2.6
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 11, 2012, 09:19:33 pm
ZCAD need linetype property for entities. i choose from two variants:
- like AutoCAD, with an honest calculation of each dash and use of SHX shapes
- like LibreCAD using fake dash in display space (with glLineStipple) without SHX shapes
The first variant is preferable, but very complex. Perhaps there is still a ways?
Title: Re: CAD program written in Lazarus / FPC
Post by: noctrex on September 13, 2012, 12:31:14 pm
Amazing work!
Keep it up!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 14, 2012, 09:02:05 am
noctrex
Thanks.

I will do linetype like in AutoCAD
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 09, 2012, 12:10:45 pm
Need to write some GUI forms - color selection, and editor text styles. Forms i do not like and do not know how - so if someone has free time and desire to help - please help with the implementation
Title: Re: CAD program written in Lazarus / FPC
Post by: taazz on October 09, 2012, 01:20:27 pm
I'm porting mbcolorlib to lazarus it is in a very unstable state at the moment but it already produces slow (painfully slow) results on windows. I'm thinking to use BGRABitmap instead of the lazarus tbitmap but this will take some time. After I'm done it would be easy to create color selection screens for any one.

some teaser shots.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 09, 2012, 08:52:07 pm
taazz
Where to find these components?
Title: Re: CAD program written in Lazarus / FPC
Post by: jmpessoa on October 09, 2012, 09:51:01 pm
See:
http://www.davdata.nl/math/colorpicker.html
Title: Re: CAD program written in Lazarus / FPC
Post by: taazz on October 09, 2012, 10:18:54 pm
The original components can be found at http://mxs.bergsoft.net/index.php?p=2 (http://mxs.bergsoft.net/index.php?p=2).
The ported components are only on my disk at the moment, I need to clean the code for each component and test them on various widget sets. For the moment they only work on win32 they do not work with GTK and I haven't tested them with QT yet.

In any case I can send you an archive of my current development tree if you want to try them out on windows.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 10, 2012, 03:57:49 pm
taazz
please send me zamtmn(at)yandex.ru

jmpessoa
thanks
Title: Re: CAD program written in Lazarus / FPC
Post by: taazz on October 10, 2012, 04:37:52 pm
I will send you everything I have so far probably tomorrow. I need to change some painting from pixel based to rawimage based 1st other wise they might be too slow for any kind of use. Hopefully I'll finish that tonight. Be forewarned the code does not work on gtk haven't tested it on qt and I'll never test it on MACos.

I have small workaround for GTK to work and I might implement that as a 1st port until I find out why they do not work.

Regards
Title: Re: CAD program written in Lazarus / FPC
Post by: taazz on October 11, 2012, 03:10:43 pm
Send. Everything should be in your mailbox.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 23, 2012, 09:39:38 am
The simple form of the color selection already works. Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: BlueIcaro on November 01, 2012, 05:43:31 pm
@zamtmn:
 do have plans to add the feature of import more formats files, like step, igs, etc, to your program?

/BlueIcaro
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 01, 2012, 06:26:31 pm
BlueIcaro
Yes, I would like it. But this is not such an important task for me. As long as I use to import the fpvectorial package, but the import procedure did not finish.
You have an interest in these formats?
Title: Re: CAD program written in Lazarus / FPC
Post by: BlueIcaro on November 01, 2012, 06:36:15 pm
BlueIcaro
Yes, I would like it. But this is not such an important task for me. As long as I use to import the fpvectorial package, but the import procedure did not finish.
You have an interest in these formats?
Yes I'm interest in this formats, I started to study the specifications, but I don't have time (I program Pc's for hobbie). Did you have some information/code, about this?

/BLueIcaro
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 01, 2012, 06:50:37 pm
Did you have some information/code, about this?
/BLueIcaro
No, I do not know these formats
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 10, 2012, 07:55:48 pm
I decided to use the package FCL-STL. Because of an error with this package program does not compile on FPC2.6.0
To fix you need manually compile files
gmap.pp
gset.pp
gutil.pp
from folder fpc/source/packages/fcl-stl/src/ аnd put result *.o;*.ppu to folder fpc/2.6.0/units/$(TargetCPU)-$(TargetOS)/
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 14, 2013, 05:35:47 pm
Hi All!
I need the implementation of triangulation polygon with holes in pascal. Can not find anything(( Such libraries are not? I'm bad looking?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 01, 2013, 11:01:59 am
Hi All!
Added simplified support for TTF fonts. As outlines without filling.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 26, 2013, 11:49:20 am
Hi All!
Uploaded a new version. Many minor bugfixes and improvements
Title: Re: CAD program written in Lazarus / FPC
Post by: BigChimp on April 26, 2013, 02:16:46 pm
Thanks - not a CAD user myself, but I love the fact that such a program is available programmed in Lazarus/FPC!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 26, 2013, 09:59:55 pm
BigChimp
I'm not at all sorry that I chose FreePascal (may be slightly TOpenGLControl already very long does not work in qt  :-X), everything is simple and clear. Writing complex program which are using himself is very interesting
Title: Re: CAD program written in Lazarus / FPC
Post by: motaz on April 27, 2013, 07:15:12 am
Nice new application.
I suggest to you that to put it in Lazarus applicaitons gallery. It will be a true addition to that page:

http://wiki.lazarus.freepascal.org/Lazarus_Application_Gallery
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 27, 2013, 08:04:12 pm
motaz
Thanks.
I've already written on this page http://wiki.freepascal.org/Projects_using_Lazarus#ZCAD . zсad is not a complete application, there are a lot of problems and a lot needs to be done
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on May 02, 2013, 08:23:43 am
Hi All!
I used to triangulate TTF glyph outlines GLU tessellator. TTF fonts are now rendered completely.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 22, 2013, 09:28:39 am
Hi All!
Now, using a small patch (http://bugs.freepascal.org/file_download.php?file_id=18484&type=bug) ZCAD can run under Linux using qt, not just gnome
Title: Re: CAD program written in Lazarus / FPC
Post by: exdatis on June 22, 2013, 10:34:45 am
Thank you very much.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 24, 2013, 05:38:48 pm
Hi All!
I compared a speed of displaying drawings in ZCAD vs LibreCAD. ZCAD much faster. Working with large drawings much more convenient.
But, unfortunately, a set of tools for working in ZCAD yet very small.
Title: Re: CAD program written in Lazarus / FPC
Post by: ahmetnurideniz on July 21, 2013, 01:56:53 am
Hi All!
I compared a speed of displaying drawings in ZCAD vs LibreCAD. ZCAD much faster. Working with large drawings much more convenient.
But, unfortunately, a set of tools for working in ZCAD yet very small.
Dear zamtmn your project is very good. I believe you will add a lot of tool in the future.
I am Cam program developer  and   believe me your project is very well
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 22, 2013, 09:45:26 pm
ahmetnurideniz, thank you for your appreciation. Your CAM program develop in Lazarus or Delphi?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 29, 2013, 01:38:37 pm
Hi All!
New example is added. He shows how to use the built object inspector.
http://svn.shamangrad.net/zcad/trunk/cad_source/advcad/
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 10, 2013, 01:18:08 pm
Hi All!
Added support for splines. As long it's just loading\saving from DXF and simple editing with the control points.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 13, 2013, 09:27:33 am
New version available sourceforge.net/projects/zcad/files - many small improvements
Title: Re: CAD program written in Lazarus / FPC
Post by: CaptBill on September 16, 2013, 08:08:06 pm
New version available sourceforge.net/projects/zcad/files - many small improvements

Is there any chance i could request a .zip file version for linux_x86? Tinycore 7zip support has bugs.
I would love to try it out.

Thanks
Bill
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 16, 2013, 09:32:16 pm
Unfortunately I was not able to cross compilation, only the old version - http://sourceforge.net/projects/zcad/files/Linux%20x86/zcad_v0.9_svn543.zip/download
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 08, 2013, 08:59:29 am
Hi All!
After many failures I was able to do dxf line type for curved entities
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 23, 2013, 09:05:36 pm
Hi All!
The turn to make the dimensional primitives. Again there is a choice to make their simplified like Libre/Q CAD or complete as in AutoCAD with all possible settings. But simple is not our way 8-)
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on October 23, 2013, 09:24:50 pm
Hello Zamtmn.

Congrats for your extremely great job.  ;)

Have you plan to read (and write) .stl, .obj, .thing 3D files ?

This kind of 3d files can be read by the "cheap" 3D printer Makerbot Replicator.

Here link of that very impressing product :

http://www.bqreaders.com/makerbot-replicator-2.html (http://www.bqreaders.com/makerbot-replicator-2.html)

Thanks.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 23, 2013, 09:50:37 pm
Hello Fred vS!
I have a lot of plans, but I understand that they are not given to all true.
The current speed of development shows that even simple things are done slowly.
I'm looking а ACIS format for 3D, but such things do not write alone not professional.
On the other side is not sophisticated 3D formats (not solid) can be fairly easy to add right now, but I do not have plan on this at the moment
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on October 23, 2013, 10:12:46 pm
Quote
On the other side is not sophisticated 3D formats (not solid) can be fairly easy to add right now, but I do not have plan on this at the moment

Yep, so, good news, it could be possible.

PS : By the way, do you know that "grand public" stereo-lithograph Makerbot Replicator machine ? That opens a huge of possibilities for prototype-makers like me...
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 23, 2013, 10:24:43 pm
I'm not familiar with the world of 3D printers, my interests lie more in the area of electrical engineering
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on October 23, 2013, 10:33:19 pm
Quote
I'm not familiar with the world of 3D printers, my interests lie more in the area of electrical engineering

Ok, thanks and bravo for your ZCAD  ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 31, 2013, 02:12:26 pm
Hi All
Dimensions in DXF complicated and confusing thing. Added initial support for the dimensional primitives and styles. ZCAD becomes like a complete CAD program

Fred vS
Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 06, 2013, 06:56:18 pm
Hello everybody, hello zamtmn  ;)

After research, it seems that the standard type of file for 3d printers is stl .
http://en.wikipedia.org/wiki/STL_%28file_format%29 (http://en.wikipedia.org/wiki/STL_%28file_format%29)

This technology is growing very fast...  :-X

And the best 3d printer comes from.. the Netherlands : Ultimaker.
https://www.ultimaker.com/ (https://www.ultimaker.com/)

Ultimaker 3D printer seems to be better than the US "champion" : Makerbot. http://www.makerbot.com/  (http://www.makerbot.com/)

There is also a factory (from Netherlands too) who prints your 3d object and sent it to your home with DHL.
You only have to sent them your stl file.
https://www.shapeways.com/ (https://www.shapeways.com/)

So it will be very nice if ZCAD could deal with stl files.

Many thanks.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 06, 2013, 08:17:15 pm
Hi Fred vS!
So far my plan is to :
- full implementation of the dimension styles and entities
- improvement of the engine, separate graphical part from DXF entities, additional of low-level graphics primitives, implementation of spatial tree for low-level graphics primitives
- improvement of existing DXF entities
- maybe to add nonOpenGL (canvas) renderer
- maybe to add raster DXF entity


So soon I will not be able to implement any new format. But I can provide all possible assistance to you if you want to do it.
Coming soon all you need:
- Implement a mesh primitive
- Implement a solid primitive
- Implement load and save to STL procedure
At my first glance it is not that difficult.
Really complicated thing that need it boolean operations for 3D solid
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 07, 2013, 07:55:39 pm
@ zamtmn : ok, i gonna (try to) understand how you developed zcad and then see if i can do something.

I really think there is a place for fp-zcad in that new 3d world.

Thanks

[EDIT] Hum, only to present me, i used (for loooot of time) AUTOCAD and 3D studio and few time MICROSTATION.

When i switched to Linux, in the begining i used BLENDER.
Now my working app is FREECAD http://www.freecadweb.org/ (http://www.freecadweb.org/).
It is fast, do all i want and, for me, better than LIBRECAD and QCAD...
Title: Re: CAD program written in Lazarus / FPC
Post by: Wodzu on November 07, 2013, 08:34:47 pm

And the best 3d printer comes from.. the Netherlands : Ultimaker.
https://www.ultimaker.com/ (https://www.ultimaker.com/)


Hi, I just wanted to tell you that there is a cheap 3d printer that you can buy for yourself but you need to build it from parts at home  8-)
Atleast I saw that few months ago on a kickstarter page :)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 07, 2013, 08:43:11 pm
@Fred vS
Unfortunately I have not a programmer, so the source code is not called many things by their right names. I also often "invent" some ways, and then learn from the books they have to look right.
No comments in the code, in the next few days I try to comment out the key points and to describe here on the forum, what is worth paying attention.
ZCAD until more research than complete system. Some of the same things I'm doing differently in different places, that reveal how to make them more convenient and faster
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 07, 2013, 08:48:03 pm
@  Wodzu : Yep, of course, there are the DIY (Do It Yourself) kits, starting at 200 euros ! example : http://printrbot.com/ (http://printrbot.com/)

What i love in that new techno is that there are some open-source producers.

The UltiMaker products are open-source too.

If i noted UltiMaker and Makerbot it is because they sell complete machines, working out of the box.
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 07, 2013, 08:51:29 pm
Quote
@Fred vS
Unfortunately I have not a programmer, so the source code is not called many things by their right names. I also often "invent" some ways, and then learn from the books they have to look right.
No comments in the code, in the next few days I try to comment out the key points and to describe here on the forum, what is worth paying attention.

No problems, im a explorer  ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 10:51:30 am
Hello.

There is a dxf to stl converter : http://code.google.com/p/meshmagick/source/browse/trunk/dxf2stl/dxf2stl.py (http://code.google.com/p/meshmagick/source/browse/trunk/dxf2stl/dxf2stl.py)

It is in python language but maybe it can help.

Usage :
Quote
dxf2stl.py infile.dxf > outfile.stl
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 08, 2013, 05:57:09 pm
@Fred vS
Can you attach here an example STL file?
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 06:11:31 pm
Quote
Can you attach here an example STL file?

With pleasure  ;)

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 08, 2013, 06:18:39 pm
As I understand it, they can be binary and text. To start the text will be more evident
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 06:22:18 pm
Quote
As I understand it, they can be binary and text.

Ooops, yes, and i give you a binary one.
Gonna try to give you a  asci one...
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 06:33:02 pm
Hello.

Here a ascii <> Binary STL converter. Free and open-source given by MakerBot :

https://www.thingiverse.com/thing:39655 (https://www.thingiverse.com/thing:39655)

It is in ruby code.

I gonna try it to translate the binary stl i give before.
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 07:35:14 pm
Hello.

Here the ascii stl file...

PS : Ruby code is not so far than Pascal, so very easy to translate into Pascal.  ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 08, 2013, 07:50:24 pm
@Fred vS
In such kind is very easy to load. ZCAD has 3Dface entity, only need to convert triangles from file into 3DFace`s.
But it has no practical value in my opinion, STL is not suitable for working with 3D objects, it is only good for the end result
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 09:45:14 pm
Quote
STL is not suitable for working with 3D objects, it is only good for the end result

Totally agree, STL is a end-ready-to-use file for stereo-lithographic machines.
Not really a "working-edit" file. (maybe it was the goal of that kind of file, a "protected" 3d file, good for designers of the 3d objects).

Quote
In such kind is very easy to load. ZCAD has 3Dface entity, only need to convert triangles from file into 3DFace`s.

So, good news, zcad is ready for the 3d revolution, only need a "export to stl"  ( "import from stl" has no sense ).  ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 08, 2013, 10:13:42 pm
Import makes sense, at least to see the result.
For internal use more suitable something using NURBS surfaces - compact and editable
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 10:28:05 pm
Quote
Import makes sense, at least to see the result.

Yes, but if the conversion is ok, the result is the same as the zcad file.
Of course "Import STL" is a plus.

PS : LibreCad do export to STL but do not import from STL.
        SketchUp do export to STL (via plugin) but do not import from STL.
        FreeCad do export to STL and do import from STL.         
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 08, 2013, 10:58:45 pm
If you want, I can make the blank to the following procedures. something like
to import:
Code: [Select]
procedure STLImport(filename:string);
begin
       //read file and call
       MaceTriangleInDrawing(x,y,z);//something like
end;
for export:
Code: [Select]
procedure STLExportHeader(filename:string);
begin
       //write header
end;
procedure STLExportTriangle(x,y,z:double);//it will be called for each triangle in the drawing
begin
       //write triangles
end;
procedure STLExportEnd;
begin
       //write footer
end;
These procedures will be available from the zcad interface as import and export commands
Implementation of the file format I will not yet engaged. better I'll improve 3DFace, and maybe start implement the NURBS surfaces.
Title: Re: CAD program written in Lazarus / FPC
Post by: Fred vS on November 08, 2013, 11:03:37 pm
Quote
These procedures will be available from the zcad interface as import and export commands
Implementation of the file format I will not yet engaged. better I'll improve 3DFace, and maybe start implement the NURBS surfaces.

Ok, perfect and... take your time, be cool, nothing is burning... ;)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 01, 2013, 11:08:44 pm
Hi all!

I simplified and commented out the drawing commands interface. If earlier these commands represent themselves classes with methods OnMouseMove like, now they are flat procedures.
Part responsible for event handling is moved to the simple procedure Get3DPoint.
Structure greatly simplified and is now similar to
Code: [Select]
Procedure DrawLine;
...
p1=GetPoint();
p2=GetPoint();
CreateLine(p1,p2);
...
Example commands for drawing aligned dimension you can see here http://svn.shamangrad.net/zcad/trunk/cad_source/commands/gdbcommandsexample.pas , the result of a command in the attached animated gif
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 11, 2013, 11:38:20 am
Hi all!

I implemented a simple dimensional primitives (linear, aligned, radius, diameter), now in ZCAD you can fully draft a simple drawings
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on January 08, 2014, 09:23:24 pm
Hi all!

New version (rev 856). Many small improvements and enhancements object inspector. Now it can display graphics and buttons
Title: Re: CAD program written in Lazarus / FPC
Post by: BigChimp on January 09, 2014, 10:37:35 am
Impressive-looking screenshot, zamtmn, thanks a lot for your hard work and generosity!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on January 21, 2014, 08:38:33 pm
BigChimp
Thank you!

All
Project need help in the form of writing some GUI windows
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on January 28, 2014, 08:46:20 am
Hi all!

New build for linux (rev 860) - fix focus handling with qt widgeset
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 02, 2014, 05:19:52 pm
Hi all!

Object Inspector learned to use undo-redo stack (rev 877). Now entity changes through the inspector you can undo
Title: Re: CAD program written in Lazarus / FPC
Post by: sin_dragan on February 02, 2014, 09:47:03 pm
Hi, first of all, let me say thank you for this great work.  :)

I tried to run the latest rev on my laptop Win7 64 with theme set to best performance and I get the blank work area (picture attached) when I switch to default Win7 theme then it's okay, anybode else have this behaviour?

Keep up the good work!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 03, 2014, 03:47:32 am
Hi,
It seems that is not created OpenGL context. ZCAD uses TOpenGLContext component (slightly modified) from the Lazarus distr. Check as operating in this mode examples from lazarus\examples\openglcontrol\
Also please give values Render\(Device,Version,Vendor), as in screenshot, create drawing -> move the mouse -> right-click ->copy value

UPDATE:
Also I do not think that disabling themes give more performance, unfortunately integrated graphics has a very low performance when drawing a large number of lines, it is better to use a discrete graphics. Or need to write GDI+ render :(
Title: Re: CAD program written in Lazarus / FPC
Post by: taazz on February 03, 2014, 10:06:26 am
Or need to write GDI+ render :(

OK. Give me an interface or abstract class to implement and I'll write you a GDI+ render-er.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 03, 2014, 12:53:02 pm
taazz
While I have not delved into the particular GDI+, but I do not think that he will render difficult. The main problem to add 2D data, it need to calculate and store, calculate on the fly is slowly. My "abstract" rendering class copying Opengl structure, is a simple layer minimizing switching states, and operate on 3D data.
Please look at what works now: https://svn.shamangrad.ru/zcad/trunk/cad_source/misc/OGLSpecFunc.pas
Based on this need to develop a generic class.
Title: Re: CAD program written in Lazarus / FPC
Post by: marcov on February 03, 2014, 02:22:31 pm
UPDATE:
Also I do not think that disabling themes give more performance,

It does on GDI on XP.   In later versions it doesn't matter so much, but turning off the settings in system -> "advanced settings" ->  performance -> "visual effects" still has quite some effect.
(my test was painting bitmaps btw, with a stretchdraw Metafile over it, I have no post Vista measurements, because in that time I changed it to opengl)


Quote
unfortunately integrated graphics has a very low performance when drawing a large number of lines, it is better to use a discrete graphics. Or need to write GDI+ render :(

With laptops that is hard. Specially because opengl is there often no option either, at least for showing bitmaps (till HD 4500, OpenGL misses non-poweroftwo textures)
Title: Re: CAD program written in Lazarus / FPC
Post by: sin_dragan on February 03, 2014, 07:56:07 pm
Hi, I tried on my work computer with best performance settings and it shows correctly, must be my laptop, I have an old X3100 Intel integrated card.
The value under Render on all is: OpenGL context is not created.

I use this to gain extra pixels because of my monitor being small :)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 04, 2014, 04:41:11 pm
sin_dragan
Other OpenGL programs work normally? this problem occurs only in ZCAD?
Title: Re: CAD program written in Lazarus / FPC
Post by: CM630 on February 20, 2014, 08:47:10 am
Just a little recommendation- it would be better if you remove the recent files list from the distribution binaries.
BTW, заставка крутая!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 20, 2014, 09:08:10 am
paskal
For this there is a command Debug\**Utils\Clear file history. But all the time I forget to do it before publishing the binaries((

>>BTW, заставка крутая!
))
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 01, 2014, 10:14:17 pm
New revision 893. Fixed some silly bugs with undo&object inspector
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 02, 2014, 08:29:24 pm
Hi all!

New version (rev 900).
Some improvements in dxf load\save procedures. Fix some memory leaks.
Title: Re: CAD program written in Lazarus / FPC
Post by: jaky2551 on April 15, 2014, 05:04:07 am
thank  :D  :D  :D
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 20, 2014, 11:01:02 pm
Hi all!

ZCAD has some initial capabilities for 3D drawing. On these animated gifs I tried to show the simple 3d figure creating and camera control

Creating simple 3d figure with object snap, polar tracing and direct length specify
http://i57.fastpic.ru/big/2014/0421/79/f40e7b2241e5f0e7edfe4ce6243e8a79.gif

Dimensions and move camera
http://i60.fastpic.ru/big/2014/0421/4e/c4a8b693e8ed17f69bcb9070e371ad4e.gif
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 22, 2014, 10:31:32 pm
Hi all!

ZCAD supports drawing by grid. Although I do not consider this mode fit (object trace and object snap easier for me, so by default only they are), I implemented it. Screenshot much better than my poor English will explain how to turn on a grid - see attachment.
These settings are saved in the drawing and may be different in different drawings. The default settings are stored in the \template\default.dxf file

I am often asked about drawing by grid. To remove these questions I will answer here on the forum
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on May 26, 2014, 10:51:05 pm
Hi all!

Another question I am often asked by people interested in zcad.
-On a very large drawings, graphics processing speed decreases. Is it possible to increase the speed?
I will answer here to avoid repetition.

Most often, the performance drop due to errors in the program. So drawing is better to send me to fix errors.

But if the speed limited by the number of entities in the drawing, there are ways to increase the speed by reducing the usability

1) parameter Render\Degradation while pan - If true, when you pan drawing, all  text\mtext entities simplistically drawn boundaries

2) parameter Render\Maximum single pass time - If not zero, it number in milliseconds spent on one rendering pass. that has not had time to finish will draw later in OnIdele handler. If zero (default) all been drawn in one pass

3) parameter Render\Image degradation - If enabled, some small details smaller than Current degradation factor are not drawn. if the Last render time is greater than Prefered rendering time then inc(Current degradation factor), else dec(Current degradation factor)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 05, 2014, 11:15:10 am
Hi all!

Long time I want to separate the graphics part implementation from DXF entities, and did not begin this work.
I would like to immediately make the right architecture and be able to add variety render systems, not only OpenGL as it is now.
To do this, I want to add a low-level graphics primitives, to include all methods for displaying on the screen and select them with the mouse. Thereby relieving and simplify the implementation of DXF primitives
Perhaps someone has already dealt with such things and can tell me where i can see examples of this approach? Perhaps there are simpler solutions?
Title: Re: CAD program written in Lazarus / FPC
Post by: wp on June 05, 2014, 04:52:40 pm
If you want to dive into the details of TAChart you'll find something like that: IChartDrawer and TBasicChartDrawer in TADrawUtils,  TCanvasDrawer in TADrawerCanvas, TBGRABitmapDrawer in TADrawerBGRA etc. See also http://wiki.lazarus.freepascal.org/TAChart_documentation#Drawers
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 06, 2014, 02:03:53 pm
wp
Unfortunately, this should not only be different drawer. Data types differ in different cases.
For example 3D point for Opengl or their projections for canvas drawers, or insertion point and radius of the circle for canvas and a series of lines approximating this circle for OpenGL drawer
Calculate projection, or approximate the nonlinear objects while drawing very slowly. This must be done in advance and save
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 07, 2014, 01:40:56 pm
Hi all!

I think implement architecture shown in the screenshot.
Now all 3-level implemented in DXF entities, which makes them extremely difficult
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 10, 2014, 08:54:53 am
On level 2 and 3 there is a large increase in the data size. Simply DXF entity such as line because of the linetype can be represented by thousands of dash. So I think here  will have to abandon using classes or objects and use paced records in raw memory
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 11, 2014, 09:11:23 pm
Hi all!

I implemented the beginning of drawer classes:
Code: [Select]
TZGLOpenGLDrawer=class(TZGLAbstractDrawer)
                        public
                        procedure DrawLine(const i1:TLLVertexIndex);override;
                        procedure DrawPoint(const i:TLLVertexIndex);override;
                   end;
TZGLCanvasDrawer=class(TZGLAbstractDrawer)
                        public
                        canvas:tcanvas;
                        midline:integer;
                        procedure DrawLine(const i1:TLLVertexIndex);override;
                        procedure DrawPoint(const i:TLLVertexIndex);override;
                   end;
And did a little test. For canvas I got dismal results on small drawing (~31K lines)
OpenGLDrawer - ~5msec
CanvasDrawer - ~80msec
Seems this ends my attempts to use canvas for render backend
Title: Re: CAD program written in Lazarus / FPC
Post by: CaptBill on June 12, 2014, 04:27:08 am
Hi all!

I think implement architecture shown in the screenshot.
Now all 3-level implemented in DXF entities, which makes them extremely difficult

Hi Zamtmn,
If you could make it an option, for high resolution output, that would be good. This is what I need for doing CAM for CNC.
Plus, even in design mode, a few 'index able guides' are good to have, which will need hi-resolution. Would be really nice if you could set each entity at 1,2,or 3rd level resolution.

Or even better, just give it a 'resolution' value that could be set per-entity. That will open up all kinds of possibilities, and is crucial for some types of operations. If you can define the resolution, you have the tools you need to give it 'index-able' features. Just something to consider.

Conversion from a high res dxf is a very simple translation into gcode.. Your CAD application could also do CAM as well if it can be 'printed' to hi-res gcode.

I am testing out an new CNC controller that is looking really promising. Would be great to see an 'all Lazarus' CAD/CAM solution to go with it.

Looking really good,
Thanks

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 12, 2014, 09:15:26 am
CaptBill
I do not quite understand what you mean. Resolution does not matter, all DXF entities processed with double precision. Low level primitives created in precision of the display device (double\single for OpenGL, single for GDI\GDI+) and in the DXF file are not saved and created only in moments display the drawing.
What I understand from your words, I think so - just need a command to convert the complex DXF entities into simple primitives - call it an "explode". Moreover, the explode should be to level2 and level3. And several supporting commands for example convert arc to lines with a predetermined length


I added the beginning of GDI+ drawer. More accurate test results:
OpenGLDrawer - ~5msec
CanvasDrawer - ~140msec
GDIPlusDrawer - ~3800msec :o
The same drawing ~31K lines, all they are drawn. In the previous test some lines is not drawn, as they were outside the viewing area
Title: Re: CAD program written in Lazarus / FPC
Post by: CaptBill on June 12, 2014, 11:01:13 am
Ok, I will try to explain it better.

A dxf file defines a line as simply two points. What would be good , and unique that I am aware of, is to have the ability to convert a 'line' into a 'path' and used like a 'smart guide'.

We need an 'indexable' line. If we could simply attach the line or object to a rotary knob and move along it from start to finish, you are in good shape. You have complete control of the entity/line to do some really neat stuff. These types of things are usually done as an afterthought or left up to some 'converter/renderer'. This is really all that is need for doing 'parametric' modeling.

Also, I should mention, if you are doing this with the X and Y axis, you can quite simply compute the A axis(rotational/normal vector) too. Once you compute in 2.5d, the other 2.5d can be obtained by adding the z axis and do the same thing. Now you can drive a 5 axis cnc machine, and most importantly, understand it all without some 'CAM software/renderer'. Plus, you are set up, since it is already indexed, to be able to do 'keyframing' and do fancy 'velocity profiling' and such.

This is necessary for CNC anyway. It is just typically done AFTER the fact. If you set it up at the early CAD (design) stage, in the beginning, this would be very good.

Just some ideas.

Cheers
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 12, 2014, 02:52:49 pm
CaptBill
It seems I understand what you're saying. You propose to do to me in addition OpenGLDrawer and GDIPlusDrawer, also CNCDrawer og GCodeDrawer. I guess it makes sense, but I am far from CNC, it should made a person interested in and knowledgeable in CNC. While I'm not willing to try to do


I upload simple test - this draw 1000 random lines with Canvas (left panel) and GDI+ (right panel)
Canvas - ~3msec
GDI+ - ~160msec
 :o
I think many people use GDI +, I ran into him the first time and probably not the correct use. Such poor results should not be.
Code: [Select]
procedure TForm1.GDIPlusPaint(Sender: TObject);
var
  i:integer;
  w,h:integer;
  LPTime:Tdatetime;
  graphicsGDIPlus:TGPGraphics;
  pen: TGPPen;
begin
     w:=TPanel(Sender).Width;
     h:=TPanel(Sender).Height;
     graphicsGDIPlus := TGPGraphics.Create(TPanel(Sender).canvas.Handle);

     pen:= TGPPen.Create(MakeColor(255, 0, 0, 0), 1);
     LPTime:=now();
     for i:=0 to linescount do
     begin
          graphicsGDIPlus.DrawLine(Pen,random(w),random(h),random(w),random(h));
     end;

     lptime:=now()-LPTime;
     Label2.Caption:='GDIPlus '+inttostr(round(lptime*10e7))+'msec';
     pen.Free;
     graphicsGDIPlus.Free;
end;
Test source and binary - http://sourceforge.net/projects/zcad/files/gditest.zip/download
Title: Re: CAD program written in Lazarus / FPC
Post by: CaptBill on June 12, 2014, 08:12:52 pm
Quote
It seems I understand what you're saying. You propose to do to me in addition OpenGLDrawer and GDIPlusDrawer, also CNCDrawer og GCodeDrawer. I guess it makes sense, but I am far from CNC, it should made a person interested in and knowledgeable in CNC. While I'm not willing to try to do


I wasn't asking you to 'do it for me', haha. No, I just wanted to suggest ideas at the basic level concerning drawing that you might consider. Of coarse, 'indexable' entities are not only good for CNC but many, many things. I only use CNC as an example.

Think of simple operations like, 'arraying' 10 squares evenly on a line. To do this you need to have an indexed line of some sort. Add in the 'normals' and you can array them on a curve with the correct orientation. That is a very advanced CAD operation but is easy if you plan early on.




Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 12, 2014, 08:56:14 pm
>>Add in the 'normals' and you can array them on a curve with the correct orientation.
>>That is a very advanced CAD operation but is easy if you plan early on.
OK, I finally understood. We're talking about the same thing, just in different languages. You mean the CNC, I'm talking about the graphics engine and very bad English)) Part of this work I already done, look animated gif http://i64.fastpic.ru/big/2014/0612/34/3d844e91105d7571b0a2deae5c85c534.gif

>>I wasn't asking you to 'do it for me', haha.
And I do not say "do yourself." I try to implement interesting ideas))
Title: Re: CAD program written in Lazarus / FPC
Post by: CaptBill on June 13, 2014, 12:14:42 am
Quote
OK, I Part of this work I already done, look animated gif
http://i64.fastpic.ru/big/2014/0612/34/3d844e91105d7571b0a2deae5c85c534.gif

YES. just like that. Now if you simply provide a 'computeNormal' function, which is a simply triangulated from two adjacent points within the line/path. By obtaining this data early on vs later on (like most cad/graphics apps do), makes life much easier later on.

This is how Google Sketchup is doing things. It has the ability to follow entities as paths, from the start. That is how it's advanced mouse techniques are being done. Each 'entity' is set up with indexes like 'center' and even the 'golden section', for example. They set up the entities with 'indexable' properties from the very beginning. In fact, that is the key attribute Sketchup seems to use. 

I would like to make a plug-in for CNC and these types properties would make things easier and more 'intuitive'.

Just some ideas for you.

Cheers

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 15, 2014, 12:24:16 am
CaptBill
Thanks, I'll try to implement it.

All
I improved a test http://sourceforge.net/projects/zcad/files/gditest.zip/download , it now shows the results for Canvas, GDI+, AGG and OpenGL.
Can somebody give the results here (just copy-paste from memo)? I'm interested in computers with integrated graphics, and any ATI/AMD. Unfortunately I did not have it.
Title: Re: CAD program written in Lazarus / FPC
Post by: Blaazen on June 15, 2014, 12:48:28 am
Hello,

I tested only in Laz. 1.2.2 under Wine (I cannot install LazOpenGLContext.lpk in Laz. trunk).

OpenGL driver info: X.Org Gallium 0.4 on AMD RV730 1.4 (3.0 Mesa 10.0.3)
Draw 10000 random lines
Canvas: 41msec
GDIPlus: 2079msec
AGG: 1704msec
OpenGL: 6msec

OpenGL driver info: X.Org Gallium 0.4 on AMD RV730 1.4 (3.0 Mesa 10.0.3)
Draw 10000 random lines
Canvas: 39msec
GDIPlus: 2103msec
AGG: 1711msec
OpenGL: 6msec

OpenGL driver info: X.Org Gallium 0.4 on AMD RV730 1.4 (3.0 Mesa 10.0.3)
Draw 10000 random lines
Canvas: 39msec
GDIPlus: 2093msec
AGG: 1700msec
OpenGL: 7msec

It is Radeon Mobility HD4670 with open source driver in Linux.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 15, 2014, 02:08:57 pm
Blaazen
Thanks!

Can somebody give the result of the native WinXP?
Title: Re: CAD program written in Lazarus / FPC
Post by: airpas on June 15, 2014, 02:42:08 pm
winxp :
OpenGL driver info: Intel Intel Bear Lake B 1.4.0 - Build 7.14.10.4906
Draw 10000 random lines
Canvas: 37msec
GDIPlus: 5605msec
AGG: 2152msec
OpenGL: 0msec

win7 32bits :
OpenGL driver info: NVIDIA Corporation GeForce GT 610/PCIe/SSE2 4.4.0
Draw 10000 random lines
Canvas: 19msec
GDIPlus: 624msec
AGG: 884msec
OpenGL: 1msec

Title: Re: CAD program written in Lazarus / FPC
Post by: _Bernd on June 15, 2014, 07:49:51 pm
Lazarus 1.2.2, Ubuntu 10.04, 32-Bit running in a VM:

OpenGL driver info: Humper Chromium 2.1 Chromium 1.9
Draw 10000 random lines
Canvas: 56msec
GDIPlus not avialible
AGG: 1189msec
OpenGL: 7msec

Regards, Bernd.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 20, 2014, 10:27:36 am
Hi all!

Thank you for participating in the test. In conclusion, the test results on a single computer, but for different operating systems
kubuntu 14.04 x64, kde 4.13.1:
qt:
Code: [Select]
OpenGL driver info: NVIDIA Corporation GeForce GTX 460/PCIe/SSE2 2.1.2 NVIDIA 337.25
Draw 100000 random lines
Canvas: 149msec
GDIPlus not avialible
AGG: 7411msec
OpenGL: 1msec

gtk2:
Code: [Select]
OpenGL driver info: NVIDIA Corporation GeForce GTX 460/PCIe/SSE2 4.4.0 NVIDIA 337.25
Draw 100000 random lines
Canvas: 348msec
GDIPlus not avialible
AGG: 7201msec
OpenGL: 2msec

windows7 x64:
Code: [Select]
OpenGL driver info: NVIDIA Corporation GeForce GTX 460/PCI/SSE2 4.1.0
Draw 100000 random lines
Canvas: 135msec
GDIPlus: 5297msec
AGG: 7885msec
OpenGL: 6msec
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 27, 2014, 01:02:03 pm
Hi all!
I started doing canvas drawer, but there were some problems with the rendering - I need to redraw the window when moving the mouse.
Around it looks:
Code: [Select]
...
var DrawInsidePaintMessage:boolean;
...
procedure WorkArea.Draw;
begin
 //here render drawing to canvas code;
end;
...
procedure WorkArea.MyOnPaint
begin
 self.Draw;
end;
...
procedure WorkArea.MyOnMouseMove
begin
 DoSomething;
 //Here i need to redraw WorkArea
 if DrawInsidePaintMessage=true
 then
    self.Invalidate
 else
    self.draw;
end;
...
If i set DrawInsidePaintMessage to true - all drawn, double buffering work, but painting is not on every move the mouse, only when the mouse stops
If i set DrawInsidePaintMessage to false - all drawn, double buffering not work, painting is on every move the mouse
In OpenGL I used DrawInsidePaintMessage:=false variant and organized my own double buffering

How to correctly organize drawing with mousemove? Or how to make cross-platform double buffering on canvas (Are there cross-platform variant CreateCompatibleDC, BitBlt, etc... with standart Lazarus canvas)?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 02, 2014, 06:06:05 pm
Hi all!
I'm surprised, GDI functions were cross-platform, thank Lazarus team. Since rev 940  GDI rendering start work.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 21, 2014, 03:23:14 am
Hi all!
Can somebody test http://sourceforge.net/projects/zcad/files/Windows%20x86/zcad_v0.9_svn948.7z/download for the presence flickering in the drawing area in WindowsXP with classic theme?
For the test before creating or loading drawing need to switch graphic backend to GDI (object inspector\render\render backend set to GDI)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 17, 2014, 03:17:58 pm
Hi all!
I'm updated a example of the use of the ZCAD engine http://svn.shamangrad.net/zcad/trunk/cad_source/simplecad/ It separate simplecad from "junk" zcad runtime files. Now it's just binary file and text file for color palette description (..\components\palette.rgb)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 30, 2014, 05:40:25 pm
Hi all!
New minor release http://sourceforge.net/projects/zcad/files/Windows%20x86/zcad_v0.9_svn995.7z/download . Fixed many bugs in the Object Inspector (also added new bugs >:D), improved appearance.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 20, 2014, 12:22:25 am
Hi all!
New minor release http://sourceforge.net/projects/zcad/files/Windows%20x86/zcad_v0.9_svn1141.7z/download
- Improved appearance of the object inspector, now it fits the theme (old appearance is can also be used and is available in options)
- Added GUI for text styles control
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 16, 2015, 06:50:56 pm
Hi all!
New minor release 1259.
- Object inspector behavior improved, now you can edit geometry properties in multiple select of entities
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on May 07, 2015, 08:41:38 pm
Hi all!
New milestone - rev1346.
Support luprec, auprec, lunits, aunits, unitmode dxf variables.
The ability to control the display of linear and angular dimension units. In addition to the decimal precision the following ways to display
For linear units:
 -Scientific
 -Decimal
 -Engineering
 -Architectural
 -Fractional
For angular units:
 -Decimal degrees
 -Degrees minutes seconds
 -Gradians
 -Radians
 -Surveyors units
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on May 28, 2015, 11:54:39 pm
Hi all!
New minor release 1375.
- GDI render backend can now display text entities (SHX and TTF) in the drawing.
Now you can draw using GDI instead of OpenGL, but on large drawings, the display speed will be significantly less
Title: Re: CAD program written in Lazarus / FPC
Post by: trayres on July 14, 2015, 06:59:35 am
Hi all!
I'm updated a example of the use of the ZCAD engine http://svn.shamangrad.net/zcad/trunk/cad_source/simplecad/ It separate simplecad from "junk" zcad runtime files. Now it's just binary file and text file for color palette description (..\components\palette.rgb)

I tried to compile SimpleCad, but got this error:
simplecad.lpr(10,60) Fatal: Cannot find unit UUnitManager used by simplecad of the Project Inspector.

[Edit] I downloaded from svn @ http://svn.shamangrad.net/zcad/trunk/ and found the missing file; it just isn't @ http://svn.shamangrad.net/zcad/trunk/cad_source/simplecad/

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 14, 2015, 07:19:45 am
I update simplecad.lpi in trunk, now it work.
But last in last commits are a lot of ongoing changes, it will work, but with some problems. You will also need to comment this fragment in line 1575 generalwievarea.pas
Code: [Select]
f:=pdwg^.GetUnitsFormat;
  htext:=sysutils.Format('%s, %s, %s',[zeDimensionToString(param.md.mouse3dcoord.x,f),zeDimensionToString(param.md.mouse3dcoord.y,f),zeDimensionToString(param.md.mouse3dcoord.z,f)]);
  if param.polarlinetrace = 1 then
  begin
       htext2:=sysutils.Format('L=%s',[zeDimensionToString(param.ontrackarray.otrackarray[param.pointnum].tmouse,f)]);
       htext:=sysutils.Format('%s (%s)',[htext,htext2]);
       getviewcontrol.Hint:=htext2;
       Application.ActivateHint(getviewcontrol.ClientToScreen(Point(param.md.mouse.x,param.md.mouse.y)));
  end;
Title: Re: CAD program written in Lazarus / FPC
Post by: trayres on July 14, 2015, 07:21:53 am
You beat me to it  :D

[Edit]
After removing the code snippet from generalviewarea.pas, I get this error:
strproc.pas(49,49) Error: Identifier not found "RawByteString"

I tried to add this:
Code: [Select]
type
  RawByteString = type AnsiString(CP_NONE);

And I got this:
strproc.pas(50,35) Error: Identifier not found "CP_NONE"
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 14, 2015, 07:53:21 am
>>strproc.pas(49,49) Error: Identifier not found "RawByteString"
You need trunk fpc to try zcad. This problem is solved, but there will be new errors associated with generics, it not solve with 2.6.x
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 14, 2015, 09:49:00 am
Quote
[Edit] I downloaded from svn @ http://svn.shamangrad.net/zcad/trunk/ and found the missing file; it just isn't @ http://svn.shamangrad.net/zcad/trunk/cad_source/simplecad/
You need checkout all sources from svn.shamangrad.net/zcad/trunk/, simplecad is just a small part and it requires a lot of zcad files
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 01, 2015, 09:23:06 am
Hi all!
New minor release 1375.
- GDI render backend can now display text entities (SHX and TTF) in the drawing.
Now you can draw using GDI instead of OpenGL, but on large drawings, the display speed will be significantly less
Fix it in new 1445 release. Performance of ttf and shx fonts when using the gdi backend has increased
Title: Re: CAD program written in Lazarus / FPC
Post by: jc99 on August 01, 2015, 06:17:32 pm
Hi zamtmn,

You did quite a job here ! (WTG)
I just came across the same error as trayres when I read to use trunc fpc.
So there is no way to compile zcad with release fpc ?
One other thing: when opening the zcad.lpi all files in the except zcad.pas are striked out (not found).
It would be a good thing to do some cleanup here. (If you have time ... )
So keep the good work ...

[Edit]
Could you update the release.inc before the next commit (it was on 1386 and should have been at 1445)

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 02, 2015, 06:43:31 pm
jc99
Quote
So there is no way to compile zcad with release fpc ?
There are many minor inconsistencies, most of them are easily fixable. But I can't solve some problems with generics. With older releases of compilers (2.6.x) I get errors, for example:
Code: [Select]
Error: Incompatible types: got "TMap$QWord$ShortString$TLess$QWord.TSet$TPair$TMapCompare$TPair$TLess$QWord.PNode" expected "TMap$Pointer$QWord$TLess$Pointer.TSet$TPair$TMapCompare$TPair$TLess$Pointer.TSetIterator$TPair$Node.PNode"I can fix all the minor incompatibilities, but for generics I need some help from people who understand this more. If there will be such people, then it is feasible.

Quote
when opening the zcad.lpi all files in the except zcad.pas are striked out (not found).
This is a consequence of the recent changes in the file structure of the project. I don't use that, so I don't notice it. Will fix soon.

Quote
Could you update the release.inc before the next commit (it was on 1386 and should have been at 1445)
Normal content of this file "const RevisionStr = 'Unknown';". I enter the version number there only for publication. But sometimes I forget it, and commit these changes. Will fix soon.

Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 03, 2015, 01:59:25 pm
I made a small example, if this can be solved - zcad will work with fpc 2.6.4
http://forum.lazarus.freepascal.org/index.php/topic,29243
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 17, 2015, 11:13:27 am
Hi all!
All attempts to compile zcad  with the 2.6.4 failed. Perhaps if only to abandon the use of generics, but  I can`t do, on the contrary want to use them more, they are very helpful.
Only 3.0 (when released) and trunk((

Now I'm trying to implement a render text entities with system drawing tools. To do this I need to be able to operate with rotate and oblique angles, separate scale factor for x and y axis. See animated gif http://i71.fastpic.ru/big/2015/0817/b3/0b8a1ae583bde82c06037c8f144184b3.gif and attached test program (win only)

In native GDI calls has functions who I needed:
Code: [Select]
function SetGraphicsMode(hdc:HDC; iMode:longint):longint; external 'gdi32' name 'SetGraphicsMode';
function SetWorldTransform(_para1:HDC; var _para2:XFORM):WINBOOL; external 'gdi32' name 'SetWorldTransform';
function ModifyWorldTransform(_para1:HDC; var _para2:XFORM; _para3:DWORD):WINBOOL; external 'gdi32' name 'ModifyWorldTransform';

But it missed in LCLIntf.pas, so it is not cross-platform((. Is it possible to adapt the test program for GTK2 and Qt?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 21, 2015, 07:00:32 pm
Hi all!
After rev 1466 zcad can use GDI text out procedures to draw text entitys
Animated gif ~3Mb http://fastpic.ru/view/69/2015/0821/_5833b1d8d50c33e9fac663a598d8cfdf.gif.html
TRT_System - GDI text render, faster and more beautiful
TRT_ZGL - old internal zcad text render
TRT_Both - both ways at once, just to see the difference in pixels
Title: Re: CAD program written in Lazarus / FPC
Post by: Hansvb on August 22, 2015, 12:58:42 pm
Hi, are there plans to read and write to oracle spatial format?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 22, 2015, 01:01:28 pm
No such plans. I have never encountered this format
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 15, 2015, 12:26:33 am
Hi all!
Small separation of the zcad source code. I place to a separate package object inspector used in zcad https://svn.shamangrad.ru/zcad/trunk/cad_source/components/zobjectinspector/
It is quite functional component allowing to display and edit complex data structures directly in memory.

It supports records, objects, arrays and pointers types. Reading a data structure while it is only possible from an external file with pascal syntax, but it allows you to define data structures unknown at compile time.

a small example of usage is attached https://svn.shamangrad.ru/zcad/trunk/cad_source/components/zobjectinspector/samples/objinspbasic/mainform.pas

Works only with fpc 2.7.1 and later((
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 22, 2015, 08:13:04 pm
Hi all!
Some progress in removing the internal dependencies in the program.
Simplecad example (http://svn.shamangrad.net/zcad/trunk/cad_source/simplecad/umainform.pas) has become more simple and clean, also I added some comments
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 23, 2016, 06:43:34 am
Hi all!
A bit of cleaning up in the sources - finally separated the graphic engine and ZCAD. Removed all dependencies inside of the engine to ZCAD functions.
At the same time have moved all the units to folders by appointment and totally all renamed: zcxxxxx.pas zcad file, zexxxxx.pas - file engine. Renaming until not touches the containers, I'm thinking to change this nightmare from D6 times on something based on generics

Tried PasDoc to generate the documentation - very good looks... it remains only to comment on at least the main points
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 07, 2016, 09:28:19 am
Hi all!
Now zobjectinspector can register data types by rtti (only records, pointers and enumerated types), without external file parsing. Example - https://svn.shamangrad.ru/zcad/trunk/cad_source/components/zobjectinspector/samples/objinsprtti/
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 06, 2017, 03:01:58 pm
Hi all!
Start reworking program interface for toolbars support http://imgur.com/a/V2jAK
Since rev 2290 zcad can be compiled only with patched AnchorDocking https://bugs.freepascal.org/view.php?id=24703
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 26, 2017, 12:13:41 am
Hi all!
Finish new interface. New "stable" build 2338 https://sourceforge.net/projects/zcad/files/Windows%20x86/
Title: Re: CAD program written in Lazarus / FPC
Post by: JanRoza on August 26, 2017, 12:26:27 am
Beautiful piece of work!
Any chance of an English version of Userguide.pdf, my Russian is limited to 4 or 5 words?  :D
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 26, 2017, 12:41:55 am
>>Any chance of an English version of Userguide.pdf
One in a million((
Only if it undertakes to do by someone who knows English. I don't know English at the level.
A "complex" commands are very specific to the projects according to Russian norms, it makes no sense to translate them.

But it makes sense to make a version without the Russian specifics, just the basic drawing features. In fact, the basic drawing features of the program is very simple and I think need no explanation

>>my Russian is limited to 4 or 5 words?
Водка, баня, папиросы, девченки ))
Title: Re: CAD program written in Lazarus / FPC
Post by: wp on August 26, 2017, 01:34:03 am
I just tried the exe, loaded the teapot.dxf, did see it, but when I moved the mouse into the drawing area the drawing goes away and the drawing area is black. When I resize the window or click on some of the main toolbar buttons, the teapot comes back

I'm on Windows 10, no high-end graphics card, just the built-in intel graphic. Any special requirements for the OpenGL?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 26, 2017, 12:06:22 pm
>>Any special requirements for the OpenGL?
No, only vendor drivers, not MS default drivers.
Check Render\RD_CurrentWAParam\Vendor in Object inspector with loaded drawings.

With 3D drawings are now present bugs, but not described by you
Title: Re: CAD program written in Lazarus / FPC
Post by: wp on August 26, 2017, 12:11:24 pm
Vendor is Microsoft.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 26, 2017, 12:27:37 pm
Setup Intel drivers and test.
Title: Re: CAD program written in Lazarus / FPC
Post by: wp on August 26, 2017, 12:55:50 pm
No, I was wrong. While your program says it is a Microsoft driver I see in the Control Panel that the driver is by Intel, version 9.17.10.4459, dated May 19, 2016. Hmmh... Maybe it did not make it into Win10 correctly from Win 7? (see below) I tried "Update driver" in the same dialog --> "You already have the latest driver". I'll have to investigate...

[EDIT]
No - Win 10 was introduced in 2015. How time flies by!
There is no newer driver on the Intel site.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on August 26, 2017, 01:09:26 pm
You using the driver included in Windows, they support a limited opengl, just for show.
Download from the laptop manufacturer website normal Intel video driver...
Or use GDI render backend (set "Render\Render backend" to "GDI" before create or loading drawing) and 2D drawings
Title: Re: CAD program written in Lazarus / FPC
Post by: wp on August 26, 2017, 01:15:59 pm
"GDI" is working. Thank you.
Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko on October 10, 2017, 07:31:55 pm
Today, I downloaded ZCAD 0.9 svn 2400. I haven't tested it deeply, but so far I have some suggestions.

1. Clear The "Recent Files" List
Please the attached image.

2. User Guide
Glad to see that it has UserGuide.pdf bundled in the download. Unfortunately it is written in the language that I can't understand. Where can I find the user guide that written in English?

3. Relative Coordinate
In LibreCAD I can do relative coordinate by adding "@" symbol at the beginning of coordinate. How can I do it in ZCAD?

4. Can't Open DXF File
I tried to open one of my project drawn using LibreCAD but I got "invalid integer" error. I provided the file, you can download the dxf file for testing. I also provided the screenshot how it looks like opened using LibreCAD.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 10, 2017, 09:51:19 pm
Thanks!
1. Sorry, I often forget to do it. Try Debug\**Utils\Clear file history in menu
2. Such UserGuide has not yet been written((
3. Use polar tracking and enter needed segment length in command line. If I understand correctly what you mean see https://imgur.com/a/euZ3E
4. This is the wrong file. Look dxf specifications - https://www.autodesk.com/techpubs/autocad/acad2000/dxf/dimstyle_dxf_04.htm - in group 340 zcad expect handle (hex value) of textstyle, but librecad write textstyle name. I told them that - http://forum.librecad.org/Wrong-dxf-file-tp5712683.html I can fix it in zcad, but do I need to tune out other mistakes?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 10, 2017, 10:15:42 pm
I fix yor file. Note: zcad not support layer freze and support only dimension styles, not dimvar overriders (librecad support only one dim style in dimvar) therefore, to properly display dimensions you need setting dimstyle

Do not take LibreCAD as an ideal, there are a lot of problems. The fact that the file appears there, it means nothing. You need to try in the original AutoCAD program
Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko on October 11, 2017, 02:19:13 pm
Thanks for the answers and the fixes.

I opened the fixed files, they seemed to show correctly. I now know that it is LibreCAD fault that fails to follow the dxf standard strictly. Because you already know how to fix the file issue, will you add this feature to ZCAD? LibreCAD has good amount of users, if ZCAD can open LibreCAD files without issue, you will gain more user base.

Polar tracking is good but it cannot fully solve my problem. It only accepts length and angle of 45 degree increments. I do not know the others, but in architectural drawing we often need to use relative x, y coordinate. For example how can I do relative coordinate for @20,25 using polar tracking?

ZCAD doesn't have pdf export. It is very important, LibreCAD has built-in pdf export. Please consider to add this feature.

I noticed ZCAD does not always show grid if I zoom very far or close. It is very important because I draw things with dimension ranging from several meters to hundreds of meters. It should automatically set the grids 1x, 10x, 100x, ...

Sorry I asked too much. I really hope I can to use ZCAD instead of LibreCAD. I saw ZCAD has some features that makes it better than LibreCAD. For example LibreCAD uses MDI, which makes switching between drawings hard.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 11, 2017, 04:09:57 pm
I already fix librecad drawings loading and allow @relative coordinates for command line in trunk

>>Polar tracking is good but it cannot fully solve my problem
Press alt+s - you can setup polar angle 90, 45 and 30 degrees. I can add more angles, but that will begin to interfere for drafting

>>LibreCAD has built-in pdf export. Please consider to add this feature.
Not pdf export, but printing will be added, but it's not easy((

>>It should automatically set the grids 1x, 10x, 100x, ...
Perhaps, but I did not think this way. Grid is the past. Snap and trace - that's what you should use
Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko on October 11, 2017, 05:40:08 pm
Thank you for the relative coordinate feature. I will try it later.

Adding more polar setup angles is okay but not necessary, you should consider to allow users to type the degree directly when using the command. (I am a teacher too), I saw students prefers using mouse and click more often but I know many serious users they prefer by typing it when using CAD. Able to use keyboard for provide both the relative coordinate and the polar angle degree are great, it's really make you work fast.

For examples:
@30,20  ---> relative coordinate +20 for x and +30 for y
@30<20 ---> relative polar angle length 30 with angle 20 degree

I understand pdf export and printing are hard to implement features. I wish I can help you but my programming skills still aren't good enough for that level.

I understand you said that grid is the past. Not sure how about the others, but I use grid for visual purpose only, not for snapping. For example when I am drawing a floor plan, visually it looks good if I put a table there. But I need to know the distance between the table and the wall (without using dimension tool to measure it). I simply see that there are 8 dots between them, it means it is roughly 90cm. Very useful, isn't it?

Thank you for your attention. ZCAD really is a great program but it is not good enough for serious architectural drawing. Actually I ever tried ZCAD long time ago, I searched and tried (I believe) all the AutoCAD alternatives that can run on Linux including ZCAD. Hopefully, not long later ZCAD already has all the essential features and I can use it.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 11, 2017, 06:04:42 pm
>> @30<20
will add it, but it is not going to be tied to a of of the drawing units, the angle is always in degrees

>>I wish I can help you but
In fact, are so many simple things that are missing. Also not have enough many complex things. Some things will not ever, because I don't want or not know to do them. I'm not asking for help, but do not abandon it

Thanks for your time!

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 19, 2017, 10:45:05 pm
Hi all!

Added
@x,y
@x,y,z
@length<angle
Command line inputs.

Start printing command implementation... and immediately luck, fundamental issues are solved, it remains to configure the scale and other "trivia"
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 22, 2017, 12:15:32 pm
Scale problem solved. But I can not understand, control of the page orientation from pagesetup dialog not working... from printer setup dialog - working. This is printer4lazarus bug? (windows implementation)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 03, 2018, 09:48:14 pm
Hi all!
New icons. Partially stolen from Lazarus
Title: Re: CAD program written in Lazarus / FPC
Post by: benohb on April 04, 2018, 12:10:08 am
I think it is the best open source CAD program ;D
I have tried Freecad librecad ..Zcad   very practical .
Some important stuff trim/extend/break/join
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 04, 2018, 09:29:06 am
benohb, thanks!

>>Some important stuff trim/extend/break/join
Yes, it is in the future plans, but it will be done much later
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 19, 2018, 10:59:09 pm
  Hi all!
  I'm thinking it's time for a little rebranding - separate the project into 2 parts. ZCAD - clean CAD program, without any specificity and ZCADelectro (I have not thought about the name yet) - there will be special functions for electricians. Unfortunately, the compiler does not allow making ZCADelectro a dynamic plugin for ZCAD yet, but as soon as the compiler supports the packages, I'll do it.
  I see that the russian electric specific scares people who interested in the project. Most people think that it is something complex and specific, not a simple CAD program
Title: Re: CAD program written in Lazarus / FPC
Post by: benohb on April 20, 2018, 01:32:13 am
@zamtmn You read my thoughts  :o
By the way, I deal with the architectural field
Quote
Most people think that it is something complex and specific
For me . I try to understand the program programmatically to add features .I could not build it on Linux
But this is not a problem ..
I noticed that your program deals with objects and lines as a class  .Why do not follow the database method ??
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 20, 2018, 07:10:06 am
>>I could not build it on Linux
Need trunk Lazarus and 3.0 or trunk FPC. I've been wanting to stop and maintain compatibility with the stable release, but always something is missing.


>>I try to understand the program programmatically to add features
what interests you?

>>I noticed that your program deals with objects and lines as a class  .Why do not follow the database method ??
I think that's right. This is the only way to make fast graphics.
Title: Re: CAD program written in Lazarus / FPC
Post by: Edson on April 24, 2018, 11:44:38 pm
Interesting.

I have been playing with Lazarus and CAD in a little program: https://github.com/t-edson/TitoCad

My main objective was to implement a 3D object selection, moving and sizing.
Title: Re: CAD program written in Lazarus / FPC
Post by: benohb on April 25, 2018, 04:26:18 am

@Edson
Why parts of the project are divided ?? each components have repositorie !!


@zamtmn


Quote
Need trunk Lazarus and 3.0 or trunk FPC. I've been wanting to stop and maintain compatibility with the stable release, but always something is missing.
Good thing you are put cad_source/simplecad/
Quote
what interests you?
A lot of things . Calculate area .Advanced print settings like autocad
Quote
I think that's right. This is the only way to make fast graphics.
Exactly .. and will help developers to access the raw data to making addons or functions
Such as the Blender 3d program structure
Title: Re: CAD program written in Lazarus / FPC
Post by: Edson on April 25, 2018, 07:08:59 am
@Edson
Why parts of the project are divided ?? each components have repositorie !!

Parts of the project are divided because those parts are libraries who have independent development and are used in different projects. That's why they have a repository.  Some libraries are very complex and widely used in other projects, not all mines.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 25, 2018, 12:22:55 pm
Edson
EvalExpres.pas double in Graficador-de-Funciones-3D and TitoCad
and cant compile
Quote
DefObjGraf.pas(53,31) Error: Identifier not found "TMotPoint"

benohb
>>Such as the Blender 3d program structure
I'm watching ideas in autocad

>>A lot of things . Calculate area .Advanced print settings like autocad
If you want, you can join, and realize your interests
Title: Re: CAD program written in Lazarus / FPC
Post by: Edson on April 25, 2018, 10:16:54 pm
Edson
EvalExpres.pas double in Graficador-de-Funciones-3D and TitoCad
and cant compile
Quote
DefObjGraf.pas(53,31) Error: Identifier not found "TMotPoint"

I have updated de project in GitHub, to the last changes. TitoCad is at the very beginning state.

EvalExpres.pas is some different in Graficador-de-Funciones-3D and TitoCad. Probably it will be part of a library in the future, but now is only a unit of the project.

"TMotPoint" is defined in the unit "MotGraf3d" of the library "MotGraf-0.2".

"MotGraf-0.2" pretend to be a graphic library, working like a wrapper for the real graphic library (that is Canvas in this case, but could be replaced for some other), and include the transformations needed to convert virtuals coordinates to pixel coordinates, and the functions of scroll, zoom and rotation.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 26, 2018, 10:38:46 am
Hi all!
I've separate clean CAD. But so far I haven't done the automatic generation of the environment, form it into manual mode
https://sourceforge.net/projects/zcad/files/Windows%20x86/cad_clean.7z/download
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 27, 2018, 10:42:54 am
Edson
I failed to compile TitiCad. But I looked at the published binary. A lot of work has been done, it's very cool. But there are still a lot of problems, obvious and not. In zcad some of them are already solved. Why do the same thing? we need to unite
Title: Re: CAD program written in Lazarus / FPC
Post by: Edson on April 27, 2018, 08:37:19 pm
I failed to compile TitiCad. But I looked at the published binary. A lot of work has been done, it's very cool.
Thanks. Most of the work is done by the libraries. I can prepare a full version of the source, including the libraries, if you need.

But there are still a lot of problems, obvious and not. In zcad some of them are already solved.
Yes. A lot of problem. Actually TitoCad was more an experiment to test some libraries I made. My first need was to have a graphic library to some SQL editor and other programs. Then I ported a 3D editor library I made for a VB software (a long time ago) and used it as a 2D interfaz. Having a 3D library I decided to test in some 3D editor and TitoCad is the result and it's far from to be complete.

Why do the same thing? we need to unite
Good. I think we can start sharing some modules or libraries to reuse the code and see if finally they can be unified.
What graphic API you use? OpenGL? I currently use LCL Canvas but there is a graphic layer aimed to be adaptable to another engine, although OpenGL is some special to work.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 27, 2018, 09:14:34 pm
>>What graphic API you use? OpenGL?
zcad can use opengl, gdi and canvas as draw backend. My abstract drawer class - https://svn.shamangrad.ru/zcad/trunk/cad_source/zengine/zgl/drawers/uzgldrawerabstract.pas

Opengl and gdi - full work drawers, canvas - only for printing and draw on GUI (preview and etc.) Also necessary to make DX backend.
I try to make zсad from as much as possible independent parts. Can be identified the following parts:
-gui
-object inspector (although this is part of the gui, but the complexity of it deserves a separate punkt)
-commands
-dxf styles
-dxf entities and drawings
-dxf entities extenders
-drawers and low level graphix entities
Title: Re: CAD program written in Lazarus / FPC
Post by: benohb on April 28, 2018, 01:42:42 am

zamtmn


Quote
>>A lot of things . Calculate area .Advanced print settings like autocad
If you want, you can join, and realize your interests

This is what I wish
:D
But I have to study your entire code to make contributions

Edson
I seem  ..it is  an electronic program (I Deduced from
selection type)
Title: Re: CAD program written in Lazarus / FPC
Post by: Edson on April 28, 2018, 04:30:21 am
Opengl and gdi - full work drawers, canvas - only for printing and draw on GUI (preview and etc.) Also necessary to make DX backend.
I try to make zсad from as much as possible independent parts. Can be identified the following parts:
-gui
-object inspector (although this is part of the gui, but the complexity of it deserves a separate punkt)
-commands
-dxf styles
-dxf entities and drawings
-dxf entities extenders
-drawers and low level graphix entities
I will revise the code and I'll give my opinion. Do you have some documentation? Can it be compiled with Lazarus 1.8?

Edson
I seem  ..it is  an electronic program (I Deduced from [/size]selection type)

TitoCad? I remember I used the graphic library (an old ancestor) in a Printer Circuit Design Program a long time ago.

Now I use a similar library (https://github.com/t-edson/ogEditGraf) of what TitoCad use, for implementing the electronic diagram of the Real Time Simulator of my Compiler: https://github.com/t-edson/PicPas

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on April 28, 2018, 06:43:17 am
Edson
>>I will revise the code and I'll give my opinion. Do you have some documentation? Can it be compiled with Lazarus 1.8?
can be compiled with fpc 3.0.x and trunk Lazarus (need https://bugs.freepascal.org/view.php?id=24703). Zcad is not documented, but I can comment on problem areas quickly

benohb
>>But I have to study your entire code to make contributions
I'm sure it's not easy (my code). Ask questions, it's not really as bad as it seems))
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on May 02, 2018, 12:51:30 pm
Hi all!
I've separate clean CAD. But so far I haven't done the automatic generation of the environment, form it into manual mode
Now I've written scripts to generate the environment. Run zcad.{bat|sh} or zcadelectrotech.{bat|sh} before compiling
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 04, 2018, 10:55:01 am
Hi all!
Project moved to https://github.com/zamtmn/zcad
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 11, 2018, 11:16:50 pm
Hi all!
Binaries will be posted on github
https://github.com/zamtmn/zcad/releases/download/0.9.8-2574/cad_win32.7z
New summary filter properties help you filter selection by the criteria you want
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 06, 2018, 11:48:29 pm
benohb
Apparently my code is not perceived by other people((
I have some suggestions for the printing system:
1 monochrome mode
2 preview
I will be glad of any help.
zcad print "command": https://github.com/zamtmn/zcad/blob/master/cad_source/zcad/commands/uzccommand_print.pas
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 09, 2018, 11:41:37 pm
anderbelluno, perhaps it was a mistake?
Title: Re: CAD program written in Lazarus / FPC
Post by: Blaazen on July 10, 2018, 01:09:03 am
@ anderbelluno, perhaps it was a mistake?

Not mistake but spam.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 10, 2018, 09:22:13 pm
Blaazen
spam on this forum thrives((

benohb
Apparently my code is not perceived by other people((
I have some suggestions for the printing system:
1 monochrome mode
2 preview
I will be glad of any help.
zcad print "command": https://github.com/zamtmn/zcad/blob/master/cad_source/zcad/commands/uzccommand_print.pas
1 monochrome mode - without intervention in the engine not to do, so will do it myself
2 preview - to do just need to replace printer canvas on something else
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 03, 2018, 12:38:33 pm
Hi all!
New release:
-"stretch" command added
-version numbering changed - exclude SVN revision
-separate "clean" and "electrotech" versions

https://github.com/zamtmn/zcad/releases/tag/0.9.8.2
Title: Re: CAD program written in Lazarus / FPC
Post by: dbannon on September 03, 2018, 03:12:34 pm
zamtmm, just a suggestion.

Your git page includes a simple wiki. Dead easy to put some pictures of your app in there. They say a picture is worth a thousand words, I'd suggest in the case of a CAD program its even more than that !

Show us what it can do !

Davo
Title: Re: CAD program written in Lazarus / FPC
Post by: Thaddy on September 03, 2018, 05:11:12 pm
zamtmm, just a suggestion.

Your git page includes a simple wiki. Dead easy to put some pictures of your app in there. They say a picture is worth a thousand words, I'd suggest in the case of a CAD program its even more than that !

Show us what it can do !

Davo
http://wiki.freepascal.org/Projects_using_Lazarus#ZCAD
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 03, 2018, 09:22:14 pm
@dbannon
I added screenshots. But this is the case when words are better than pictures. If you are interested in something, it is better to ask
Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko on September 03, 2018, 10:08:41 pm
Below are a screenshot and the source I drew using ZCAD v0.9.8.2. It is based on a real project I done some years ago. The screenshot and the source are in CC0 Public Domain license.

Although there are many missing features, ZCAD is capable for architectural drawing. One feature ZCAD has but LibreCAD doesn't, is Polar Tracking.

I found a bug when using ZCAD. The mirror tool didn't mirror arc correctly.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 03, 2018, 10:50:24 pm
@Handoko
>>One feature ZCAD has but LibreCAD doesn't, is Polar Tracking.
More than one. For example - object inspector is also missing in LibreCAD. The ability to edit multiple-selected entities makes it an indispensable tool for mass editing.
I would also note the rendering speed. I often easily work in ZCAD with huge drawings, which are impossible to work with in LibreCad because of Its speed

>>I found a bug when using ZCAD. The mirror tool didn't mirror arc correctly.
Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: dbannon on September 04, 2018, 04:38:32 am
Handoko, that drawing is pretty good, how long did it take you ?

I have done a lot of architectural drawing for a house I built using Inkscape. Inkscape is really not a suitable tool for that purpose (more intended for artistic work and I'm no artist !) but I did know how to use it it. Similarly, I draw up a number of electronic drawing, again using Inkscape and again its unsuited.

Zamtmm, can you tell me what you mean by "electrotech" ? (Sorry but again I feel a screen shot would save a lot of words ! )  Can your drawings work with a 'library' of components ? For example, in drawing up electronic circuit diagrams you like to have a pile of predrawn electronic components on hand and drag then onto the drawing. In many cases, lots and lots of times.

And getting back to the architectural, dimensions are very important. Do you 'scale' your drawings so, as I add features, I can determine how big they are ? eg, I want to put a wall in, and I know its 6m long, can I easily draw a (scaled) 6m wall ?

Interesting project !

Davo

Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko on September 04, 2018, 05:09:23 am
how long did it take you ?

It took me hours because of some missing important tools on ZCAD.

I have done a lot of architectural drawing for a house I built using Inkscape. Inkscape is really not a suitable tool for that purpose (more intended for artistic work and I'm no artist !) ...

Yes, Inkscape is an awesome artist tool but it is not suitable for architectural drawing. I often combine LibreCAD + Inkscape + GIMP for the final result, for example below is the result done using all 3 of them.

If you do architectural drawing for home building/renovation, you may want to try Sweet Home 3D. It can save you lots of time.

And getting back to the architectural, dimensions are very important. Do you 'scale' your drawings ...

Yes, I mainly use 1 drawing unit for 1 cm.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 04, 2018, 07:37:48 am
Quote
Zamtmm, can you tell me what you mean by "electrotech" ?
I'm an electrical engineer and I use ZCAD in work. So there are some highly specialized things.

Quote
Can your drawings work with a 'library' of components ? For example, in drawing up electronic circuit diagrams you like to have a pile of predrawn electronic components on hand and drag then onto the drawing. In many cases, lots and lots of times.
Yes.
Library files: https://github.com/zamtmn/zcad/tree/master/environment/runtimefiles/zcadelectrotech/blocks/el/general (*.dxf - files with blocks defs, *.pas - files with blockdefs variables)
Loading these files at startup https://github.com/zamtmn/zcad/blob/master/environment/runtimefiles/zcadelectrotech/components/autorun.cmd
But I don't use drag and drop components in the work. Therefore, the insert window is inconvenient. I'm attaching a screenshot

Quote
And getting back to the architectural, dimensions are very important. Do you 'scale' your drawings so, as I add features, I can determine how big they are ? eg, I want to put a wall in, and I know its 6m long, can I easily draw a (scaled) 6m wall ?
ZCAD supports some dimensional primitives and dimension styles. LibreCAD by the way does not support dimension styles, so it has a limitation: one drawing = one scale
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 07, 2018, 12:52:44 pm
I found a bug when using ZCAD. The mirror tool didn't mirror arc correctly.

Fixed, thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 13, 2018, 07:20:11 am
Hi all!
Monochrome printing is already working. But still stay problems with the lines thickness. Lines look too thin. Need recalculate the table of line thicknesses for printing
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 11, 2018, 12:47:49 am
Hi all!
Made the command line switchable https://imgur.com/a/0vbQz89, you can now use single-letter hotkeys
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 15, 2018, 08:55:00 pm
Hi all!
Adjusted building with Lazarus 2.0RC1 & FPC3.0.4 Everything works))
You only need to install the packages:
cad_source\other\rtl-generics_for_FPC304\ - for FPC3.0.4
or
cad_source\other\rtl-generics_dummy\ - for trunk FPC

Now I will maintain compatibility with stable releases
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 23, 2018, 08:42:09 am
Hi all!
New release https://github.com/zamtmn/zcad/releases/tag/0.9.8.4
Title: Re: CAD program written in Lazarus / FPC
Post by: engerex on December 03, 2018, 07:32:47 pm
Hi,
Good project.
What is DXF and DWG version supports?
Title: Re: CAD program written in Lazarus / FPC
Post by: RastaManKing on December 03, 2018, 08:20:15 pm
Hi all!
New release https://github.com/zamtmn/zcad/releases/tag/0.9.8.4
pretty great project! some people say pascal is dead, but here you are making advanced programs, multiplatform, and native, what a great language!
long live pascal!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 03, 2018, 09:29:38 pm
What is DXF and DWG version supports?
dxf2000. I can add newer versions of dxf. But without the implementation of new primitives and opportunities, it is only a formality
I refused dwg support, it takes too much strength and can be read only

pretty great project!
Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 03, 2019, 08:32:11 pm
Hi all!
After a long break, continued development.
New GUI elements - tool palettes. Configured as xml files, can be as ListView and as TreeView with preview and filtering.
Any command can be bind to elements
Title: Re: CAD program written in Lazarus / FPC
Post by: schuler on October 08, 2019, 12:54:49 pm
Cool! A star for the repo!
Title: Re: CAD program written in Lazarus / FPC
Post by: benohb on October 11, 2019, 05:03:12 am
Good  :)
Title: Re: CAD program written in Lazarus / FPC
Post by: JanRoza on October 11, 2019, 12:39:42 pm
Would it be possible to include compiled program on Github as well? Not everyone wants to install all the needed packages in Lazarus just to give zcad a try. It looks impressive looking at the screenshots.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 11, 2019, 03:17:23 pm
JanRoza
 Include executable in the repository is wrong. Sometimes I publish "releases", but not often. Soon there will be next "release" when I finish a fully customizable context menu.

 Perhaps there are services that automatically build sources for FPC like Travis?

benohb, schuler
Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: JanRoza on October 11, 2019, 05:32:00 pm
I understand, I'll wait till your next release then.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 17, 2020, 10:38:58 pm
Hi all!
New release 0.9.8.5 https://github.com/zamtmn/zcad/releases/tag/0.9.8.5 There is nothing new, just fixes and improvements
Title: Re: CAD program written in Lazarus / FPC
Post by: jcarlos77 on March 13, 2020, 07:07:17 pm

Hello Zamtmn...

I 've tried to compile zcad a time ago... but without success...

The rtl_generics package doesn't shows the Install option on the package dialog...

Do you have any idea of why?

I'm using Lazarus 2.0.6, with fpc 3.0.4

Sorry  if it's an easy answer question...  I don't have very much experience...
Just restarting with Pascal, but my plans are long-term...

And I would like to contribute with zcad, and use it for my daily work.

Thanks in advance.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 13, 2020, 09:17:18 pm
Hi jcarlos77!

As far as I remember, this package can just be compiled ("compile" button in Package window) without installation.

You will also have problems with the zmacros package. When you open this package in LazarusIDE 2.0.6 its dependencies are lost, but this does not happen with trunk IDE. If this happens, you will need to add the following dependencies: FCL, IDEIntf, CodeTools

I apologize for such a complicated procedure for sources building, but I always lack something in the latest release((
Title: Re: CAD program written in Lazarus / FPC
Post by: jcarlos77 on March 13, 2020, 10:42:37 pm
Zamtmn...

Thank you for your fast response.
I will read the packages documentation before to proceed again.

Will give you feedback.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 15, 2020, 10:39:12 pm
I try build with Lazarus 2.0.6 and FPC 3.0.4. There are strange problems with my zmacros package(( - cannot build

Better use Lazarus and FPC from the trunk. If you don 't want to mess with the installation yourself, try fpcupdeluxe
I will support and use stable versions Lazarus and FPC immediately after FPC 3.2 is released
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 27, 2020, 09:27:53 pm
Hi All!
Now zcad works with stable release Lazarus 2.0.10 and FPC 3.2
In the future I will maintain compatibility with stable releases
Title: Re: CAD program written in Lazarus / FPC
Post by: VTwin on July 27, 2020, 11:54:46 pm
Excellent, although I have not tried to compile zcad. Do you have any comments on how it compares to qcad?  I have used qcad very briefly.

If you are trying to compete, posting binaries is likely critical.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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
Title: Re: CAD program written in Lazarus / FPC
Post by: VTwin on July 28, 2020, 12:21:21 am
Very nice. Keep up the good work.
Title: Re: CAD program written in Lazarus / FPC
Post by: Delphi100 on September 27, 2020, 09:36:07 am
Great work!
Please support Chinese [zh_CN] Unicode DXF File  !!
Thank you very much!!!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 27, 2020, 09:55:57 am
Thanks. please attach sample
Most likely shx fonts from zcad do not contain the necessary characters
Title: Re: CAD program written in Lazarus / FPC
Post by: Delphi100 on September 28, 2020, 03:25:59 am
Thanks You!
Please test the attachments!
Title: Re: CAD program written in Lazarus / FPC
Post by: Delphi100 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!

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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
Title: Re: CAD program written in Lazarus / FPC
Post by: Tomash 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 ...
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on December 30, 2020, 09:16:20 am
Hi all!
Now zcad works on Raspberry Pi
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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
Title: Re: CAD program written in Lazarus / FPC
Post by: laguna on February 01, 2022, 06:35:22 pm
Is run cad on Mac OSX?

Thanks
Title: Re: CAD program written in Lazarus / FPC
Post by: Handoko 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.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn 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
Title: Re: CAD program written in Lazarus / FPC
Post by: loaded on February 01, 2022, 09:09:44 pm
Excellent work, congratulations .
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 06, 2022, 11:56:49 am
Is run cad on Mac OSX?

Thanks
I try on VM, zcad works, but buggy((
To compile you need remove ag_vectors and ag_graph pkgs dependencies from project inspector (AGraph not compile on darwin)

loaded
Thanks!
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 22, 2022, 11:56:58 pm
Hi All!
Nightly builds appeared https://ci.appveyor.com/project/zamtmn/zcad (win32)
I am also trying to make a new user manual, remembering the old mistakes, now I use asciidoc
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on June 07, 2022, 11:09:05 pm
Hi All!
ZCad start support dxf hatch entity
https://imgur.com/a/OXpmGua
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on July 24, 2022, 10:17:12 pm
Hi All!
To be able to use LibreDWG, I changed the license from lgpl2 to dual gpl3/mpl2
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 30, 2022, 10:51:44 pm
New release 0.9.9.0
Added:
-hatch entity
-new userguide (Russian)
-html help (Russian)
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 18, 2022, 08:59:31 am
Hi,

I downloaded the latest release from github.
Try to run but the application does not start.
OS: Windows 10 Pro, 64 bit

Robert
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 18, 2022, 11:08:33 am
Hi!
Old releases works?
Spaces or nonlatin symbols in prograsm path?
Can You provide cad\log\zcad_windows.log and %TEMP%\zcadcrashreport.txt ?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 20, 2022, 07:47:35 am
Hi!

Old release 0.9.8.6 works.
There are no spaces or nonlatin in programs path.
I am providing you both logs in ZIP file.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 20, 2022, 09:49:41 am
@vertnik
It looks like the error is happening somewhere earlier (heap is spoiling) and it takes off in a harmless place. Unfortunately, the log is not enough, additional actions (build zcad from sources) will be needed to find it. Will you help me?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 21, 2022, 07:51:41 am
I build zcad from source, Lazarus 2.2.4 (OS:Win32, CPU:i386).
Compilation was successful, without errors.
But while running with debugging, I got the following error,
showed in attached picture.

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 21, 2022, 08:04:55 am
You follow this instruction https://github.com/zamtmn/zcad/blob/master/README_ENG.md ?
and runtime file \cad\rtl\system.pas exist?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 21, 2022, 09:45:52 am
Now, I installed fresh Lazarus-2.2.4-fpc-3.2.2-win64.
At step 3, when running command to install packages, I got the following error:
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 21, 2022, 10:43:12 am
It seems to me that you already have running a copy of Lazarus at the time of the script launch, which the script is trying to rebuild


Try run this lazarus copy and rebuild it from GUI?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 21, 2022, 12:19:24 pm
I rebuild it from GUI ("Clean up and build"). Without any errors.
When I executed the application from Lazarus, works :)
But when I was trying do run zcad.exe outside the Lazarus, it did not worked.
The first screen is showed, but then the proccess is hanging in the background?
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 21, 2022, 02:31:55 pm
try run with "updatepo" command line swith
>>zcad.exe updatepo
if work then problem in localization subsystem. what locale in your system?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 21, 2022, 02:48:36 pm
Yes, it works.
My system locale is: slovenščina (Slovenija)
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 21, 2022, 04:11:00 pm
ok. Last release work if run as
>>zcad.exe updatepo
?
Title: Re: CAD program written in Lazarus / FPC
Post by: vertnik on October 23, 2022, 03:30:30 pm
Yes.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on October 26, 2022, 02:44:09 pm
Bug fix release
https://github.com/zamtmn/zcad/releases/tag/0.9.10.0

Fixed a localization issue and a few more minor ones problems
Title: Re: CAD program written in Lazarus / FPC
Post by: Delphi100 on November 16, 2022, 08:31:04 am
Very nice. Please check:
1、Chinese Fonts Garbled code
2、Missing fill details
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on November 16, 2022, 10:39:52 am
Unfortunately, there is currently no support for curved contours (circles, ellipses, arcs, splines). Hatching works correctly only in contours made of straight lines. The solution to this issue is difficult((

There is also no support for internal formatting of the autocad text. Try to remove formatting and tell zcad where to look for fonts
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 30, 2023, 01:02:54 am
New release
https://github.com/zamtmn/zcad/releases/tag/0.9.11.0

- Dark theme for windows
- "extdrSmartTextEnt" extender for text entities inside devices
- A few fixes and as usual a lot of new bugs))

Linux binaries are also included. Building zcad from sources still causes many problems for those interested
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on September 26, 2023, 07:21:24 am
Hi!
It became possible to draw electrical diagrams, or others where you need to get information about what is connected to what. Of course, it was possible to draw earlier, but there was no information about the connections
Title: Re: CAD program written in Lazarus / FPC
Post by: RPRI on February 13, 2024, 03:11:32 pm
Hello,

i have installed the sources but i have a problem to comile the project.
It look's that the installation goes wrong.

This is the Output from the console:
Microsoft Windows [Version 10.0.19045.3930]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

d:\Data\Lazarus\Projekte_LazV2\zcad>D:\Programme\LazarusV2\fpc\3.2.2\bin\x86_64-win64\make cleanzcadelectrotech LP=D:\Programme\LazarusV2 PCP=D:\Programme\LazarusV2
process_begin: CreateProcess((null), git describe --tags, ...) failed.
rm -rf  cad_source/autogenerated/*
rm -rf  cad_source/autogenerated
rm -rf  cad/*
rm -rf cad
rm -rf lib/*
rm -rf errors/*.bak
rm -rf errors/*.dbpas
PCP=D:\Programme\LazarusV2
LP=D:\Programme\LazarusV2
ZP=\cad\bin\i386-win32
mkdir cad
mkdir cad_source\\autogenerated
cp -r environment/runtimefiles/common/* cad
cp -r environment/runtimefiles/zcadelectrotech/* cad
cp: environment/runtimefiles/zcadelectrotech/preload/xlsxtemplates/devinxlsx/???????.xlsx: No such file or directory
D:\Programme\LazarusV2\fpc\3.2.2\bin\x86_64-win64\make: *** [zcadelectrotechenv] Error 1

d:\Data\Lazarus\Projekte_LazV2\zcad>

When i try to compile it in the IDE ksome include files are not found.
{$INCLUDE buildmode.inc}

//if missing see https://github.com/zamtmn/zcad/blob/master/BUILD_FROM_SOURCES.md
In that document i can not find a solution.

Have you any idea?

Thank you and BR
Rainer
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 13, 2024, 11:28:41 pm
Please delete environment/runtimefiles/zcadelectrotech/preload/xlsxtemplates folder

One of the developers added a file with cyrillic in the name, I'll ask he to fix it. The temporary solution is to delete these files, it will not interfere with the work

Update:
Fixed, just git pull
Title: Re: CAD program written in Lazarus / FPC
Post by: terco on February 20, 2024, 08:40:34 pm
Great job!

A friend and I we are doing a CAD in Gambas3, now starting to port it to Lazarus FPC. Maybe we can join forces!

Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on February 20, 2024, 08:47:59 pm
Thanks! I'm for it
Title: Re: CAD program written in Lazarus / FPC
Post by: veb86 on February 21, 2024, 08:42:09 am
Maybe we can join forces!

ZCAD is a very large project that allows you to solve complex design problems. Now ZCAD has partially implemented BIM design ideas, which improves the quality of the product. ZCAD works stably and at high speed.
It would be very cool to join forces to create a cross-platform CAD/BIM program with open source code.
Title: Re: CAD program written in Lazarus / FPC
Post by: zamtmn on March 07, 2024, 12:18:26 pm
In fact, if you count by the number of lines, this is a small project, only ~160 thousand lines, excluding packages. ZCAD is very lacking in basic editing tools, I have not been able to do anything in this direction for many years((
TinyPortal © 2005-2018