Hi all, 
I am a long-time user of autocad. I am recently the proud owner of QCAD Professional 3.30.1. on linux Mint 20.3.
 I am extremely satisfied with the program. However, from my working routine in autocad, I am missing a lisp program that does a simple entry of the length of a line or segment of a polyline in the form of a text field in the middle of the selected lines/polylines.
My question is how can this be done in QCAD?  https://lee-mac.com/midlen.html
Best regards!
			
									
									
						Length at Midpoint
Moderator: andrew
					Forum rules
			
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
		
		
	Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
- 
				CVH
- Premier Member
- Posts: 4957
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Length at Midpoint
Hi,
Under QCAD we write scripts in ECMAScript (JavaScript).
Almost anything is possible, your imagination is the limit.
Since WipeOuts are just being added it should be feasibly writing such code using the vast QCAD API.
The mid point is basically implemented for all line-art, always readable text and local angle should not be a problem.
Adding text or other entities to a drawing is practically the standard way that QCAD adds these from/to dxf or user input.
There are some tutorials and other links:
- https://www.ribbonsoft.com/en/qcad-scripting
- https://www.ribbonsoft.com/doc/qcad/latest/developer/
- https://www.ribbonsoft.com/en/tutorial- ... rogramming
- https://www.ribbonsoft.com/en/tutorial- ... cad-plugin
Regards,
CVH
			
									
									
						Under QCAD we write scripts in ECMAScript (JavaScript).
Almost anything is possible, your imagination is the limit.
Since WipeOuts are just being added it should be feasibly writing such code using the vast QCAD API.
The mid point is basically implemented for all line-art, always readable text and local angle should not be a problem.
Adding text or other entities to a drawing is practically the standard way that QCAD adds these from/to dxf or user input.
There are some tutorials and other links:
- https://www.ribbonsoft.com/en/qcad-scripting
- https://www.ribbonsoft.com/doc/qcad/latest/developer/
- https://www.ribbonsoft.com/en/tutorial- ... rogramming
- https://www.ribbonsoft.com/en/tutorial- ... cad-plugin
Regards,
CVH
- 
				Rolinger
- Junior Member
- Posts: 18
- Joined: Thu Aug 29, 2024 5:17 pm
Re: Length at Midpoint
Thanks for the answer. However, I have one problem - unfortunately, I'm not a programmer  
There are numerous examples of use - automatic marking of pipeline length on drawings, marking of position lengths on reinforcement drawings, etc... In the case of manual entry, the possibility of error appears, especially with a large number of positions
Is there some sort of workaround to achieve the same result in QCAD?
For example automatic dimensioning only without dimension lines!
Or let's say automatically assign a text attribute in the middle of the line/polyline that will contain the value of the line length?
Best regards
			
									
									
						
There are numerous examples of use - automatic marking of pipeline length on drawings, marking of position lengths on reinforcement drawings, etc... In the case of manual entry, the possibility of error appears, especially with a large number of positions
Is there some sort of workaround to achieve the same result in QCAD?
For example automatic dimensioning only without dimension lines!
Or let's say automatically assign a text attribute in the middle of the line/polyline that will contain the value of the line length?
Best regards
- 
				CVH
- Premier Member
- Posts: 4957
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Length at Midpoint
In QCAD there are practically no relations between entities.
Dimensions without reference lines is another issue, automatic dimensioning would clutter your drawing.
Purpose: Automatically construct a text label in the middle of the selected (line/polyline) with the textual entity length.
Don't think of this as assigning an associated attribute with linked content 
 
Given some time I might code something ... 
 
It will probably fall back on dimensions settings for text color, height, font, number format ...
Is there a specific layer reserved? Should we? Certainly handy to 'cloak' or lock them.
...
First I need to get antiquated with WipeOut's because text entities do not support a background mask.
All if there will ever be a reference on RWipeoutEntity: Entity Module
Regards,
CVH
			
									
									
						Dimensions without reference lines is another issue, automatic dimensioning would clutter your drawing.
Under ACAD a custom Lisp, under QCAD a custom Addon script.
Purpose: Automatically construct a text label in the middle of the selected (line/polyline) with the textual entity length.
Don't think of this as assigning an associated attribute with linked content
 
 Given some time I might code something ...
 
 It will probably fall back on dimensions settings for text color, height, font, number format ...
Is there a specific layer reserved? Should we? Certainly handy to 'cloak' or lock them.
...
First I need to get antiquated with WipeOut's because text entities do not support a background mask.
All if there will ever be a reference on RWipeoutEntity: Entity Module
Regards,
CVH
- 
				Rolinger
- Junior Member
- Posts: 18
- Joined: Thu Aug 29, 2024 5:17 pm
Re: Length at Midpoint
CVH wrote: ↑Mon Sep 30, 2024 9:02 amSince I am most interested in the lengths of polyline segments, I think that this is where the answer to my question lies.It will probably fall back on dimensions settings for text color, height, font, number format ...
Is there a specific layer reserved? Should we? Certainly handy to 'cloak' or lock them.
Does all of the above already work with aligned dimension? (except of course arrows and extension
line which are not displayed). With arcs and circles, we have everything solved in the Arch length dimension.
In my opinion, the splines are the only problem.
I also think it would be convenient to write the results in a separate text layer.
Best regards
P.S.
I apologize if my English is bad since it's not my native language and I'm self-taught! If something in my question is not clear, I will try to explain it in another way.
Thanks for your patience
- 
				CVH
- Premier Member
- Posts: 4957
- Joined: Wed Sep 27, 2017 4:17 pm
Re: Length at Midpoint
Menu Info .. Total Length of Selection (IS) will display the length of any line-art.
That includes single (whole) Polylines, Splines, Ellipses and Ellipse arcs.
IS is the sole exception of the Info tools that doesn't has the option to add the measurement to the drawing.
In your latest reply you talk about polyline segments ... A measurement for each segment.
Because polylines are a string of straight (lines) and bulging (arcs) segments, the Arc Length (DG) is applicable for the bulging segments.
Programmatically it handles the nearest singular shape. 
 
Straight segments can be dimensioned by an Aligned dimension (DA).
Pity that there is no Info tool for the arc length.
As said, dimensions without the dimension lines is not supported.
We can set arrow length to zero and a fixed extension line to something really short except zero.
When it doesn't need to be associated, then we can explode a dimension and remove anything but the text.
All fine for a work-around, adding length labels like the Lisp routine requires a custom Addon.
Regards,
CVH
			
									
									
						That includes single (whole) Polylines, Splines, Ellipses and Ellipse arcs.
IS is the sole exception of the Info tools that doesn't has the option to add the measurement to the drawing.
In your latest reply you talk about polyline segments ... A measurement for each segment.
Because polylines are a string of straight (lines) and bulging (arcs) segments, the Arc Length (DG) is applicable for the bulging segments.
Programmatically it handles the nearest singular shape.
 
 Straight segments can be dimensioned by an Aligned dimension (DA).
Pity that there is no Info tool for the arc length.
As said, dimensions without the dimension lines is not supported.
We can set arrow length to zero and a fixed extension line to something really short except zero.
When it doesn't need to be associated, then we can explode a dimension and remove anything but the text.
All fine for a work-around, adding length labels like the Lisp routine requires a custom Addon.
Regards,
CVH