Forum > Third party
LazCAD – First Release!
maurog:
In the latest version of LazCAD, a bug related to the "ShowRulerMarker" flag in the Object Inspector has been fixed. An exception occurred when toggling the ruler marker visibility via the Inspector. This issue has now been resolved. Additionally, a new file has been uploaded.
zamtmn:
Hi!
CADSys4 support splines? hatchs? arc segments in polylines? blocks? raster images? line types?
maurog:
Hi
BSplines: Yes (TBSpline2D).
Hatchs: No. CADSys4 manages Pen and Brush properties via Layers.
This means that entities automatically inherit the Pen and Brush properties of their parent layer.
However, I’ve modified the library so that entities now also have their own Pen and Brush properties.
Users can decide (via the Object Inspector) whether these properties should be taken from the layer or use their own settings.
For closed entities, BrushColor and BrushStyle can be set.
As far as I know, programs like AutoCAD load Hatch patterns from external files.
CADSys4 doesn’t support this functionality.
Arc segments in polylines: No.
Blocks: Yes.
Raster images: Yes. The original library supports Bitmap files.
With minimal effort, this could be extended further because FPC/Lazarus offers great support for this.
Line types: Not directly. However, the library contains a Decorative Pen Object,
which can be used to create custom line types. Here’s the author’s description:
--- Quote ---This class defines a decorative pen, that is a special Windows pen
that can have any pattern. The pattern is defined by a string of bits like
'1110001100', where a one represents a colored pixel and a zero
represents a transparent pixel. Because a decorative pen is associated with
a layer, you can manage it better.
<B=Note>: The decorative pen uses LineDDA functions to draw lines and
can only be used for lines and polylines (no ellipses are drawn using
the pattern). Redrawing the image will be slower, so use it only where necessary.
--- End quote ---
Theoretically, this could be applied to ellipses since they are also made up of lines.
However, as the author mentions, the performance would be slower. (I haven’t tested this myself.)
TDecorativePen (definition):
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TDecorativePen = class(TObject) private fPStyle: TBits; fCnv: TCanvas; fCurBit: Word; fStartPt, fEndPt, fLastPt: TPoint; procedure SetBit(const Idx: Word; const B: Boolean); function GetBit(const Idx: Word): Boolean; function GetMaxBit: Word; procedure CallLineDDA; public constructor Create; destructor Destroy; override; {: This method is used to make deep copy of the object by obtaining state informations from another. <I=Obj> is the object from which copy the needed informations. } procedure Assign(Source: TObject); {: Move the pen for the canvas <I=Cnv> to the position <I=X,Y>. } procedure MoveTo(Cnv: TCanvas; X, Y: Integer); {: Move the pen for the canvas <I=Cnv> to the position <I=X,Y>. This will not reset the current pattern bit. It is useful when you are drawing a shapes made by segment. } procedure MoveToNotReset(Cnv: TCanvas; X, Y: Integer); {: Draw a line using the current pattern and color to the position <I=X,Y>. } procedure LineTo(Cnv: TCanvas; X, Y: Integer); {: Draw a polyline using the current pattern and color. <I=Pts> are the points of the polyline and <I=NPts> is the number of points. } procedure Polyline(Cnv: TCanvas; Pts: Pointer; NPts: Integer); {: Specify the pattern for lines. The pattern is defined by a string of bits like '1110001100', in which a one rapresent a colored pixel and a zero rapresent a transparent pixel. By using this pen the redrawing of the image will be slower, so use it only where necessary. Because a decorative pen is associated to a layer you can manage it better. } procedure SetPenStyle(const SString: String); {: Contains the pattern for lines. The pattern is defined by a string of bits like '1110001100', in which a one rapresent a colored pixel and a zero rapresent a transparent pixel. By using this pen the redrawing of the image will be slower, so use it only where necessary. Because a decorative pen is associated to a layer you can manage it better. } property PenStyle[const Idx: Word]: Boolean read GetBit write SetBit; {: Contains the pattern length. } property PatternLenght: Word read GetMaxBit; end;
Here’s a short video demonstrating blocks, raster images, and brush properties in action.
https://www.hackcad.com/maindownloads/LazCAD_Blocks_RasterImage.mp4
PS. Here is another open-source CAD application based on CADSys4.
You might find useful code that could be of interest for your project.
You can check it out on SourceForge
https://sourceforge.net/projects/tpx/
zamtmn:
Thanks for the clarifications. I was referring to the real capabilities of DXF, not the surrogates provided by GDI\LCL (hatch\linetypes)
maurog:
--- Quote from: maurog on November 20, 2024, 06:05:01 pm ---Hello everyone,
I’ve uploaded a new version of LazCAD. Here are the main updates:
RuntimeScripter: The scripter is now integrated.
Limitation:
The ScripterIDE currently does not support multi-line comments in the {...} format. When importing code from Delphi, issues may occur. However, single-line comments in the // format are supported without any issues.
Simple Help: A basic HTML help system with multiple pages has been added.
It’s not complete yet but includes an overview of the RuntimeScripter functions,
so you can see what has been imported into the scripter.
Additionally, the help supports switching between English and German,
which can be configured via the inifile (use the option language=en or language=ger).
Other Changes:
--Ruler flickering fixed: Thanks to feedback from staratel20,
I’ve resolved the flickering issue by implementing double buffering.
New property for Ruler: The Ruler component now has a new property called ShowMarker (boolean),
allowing you to enable or disable markers via the Object Inspector.
--Pan functionality using the middle mouse button: This feature has been implemented,
but it’s still slightly inaccurate. I’ll fix this once I get a mouse with three buttons for testing.
--Hints: These will be improved once the application becomes multilingual.
Bugs:
There are probably still several bugs. I wasn’t able to test the entire application step by step,
as it’s very time-consuming. If you find any issues, please report them, and I’ll fix them.
Examples:
In the directory data/PascalScripts/interactive, you’ll find some example scripts.
These demonstrate basic functionalities like dialogs (e.g., OpenFile),
creating and manipulating GraphicObjects, and more.
Here’s a short video showing the updates:
https://www.hackcad.com/maindownloads/LazCAD_Scripter_Help.mp4
Thank you all for your support and feedback!
Best regards,
Maurog.
PS: The download links from the first post are still up to date.
--- End quote ---
Navigation
[0] Message Index
[*] Previous page