[Solved] turn finite or bound geometry to infinite or unbound geometry
Moderator: andrew
[Solved] turn finite or bound geometry to infinite or unbound geometry
Hello,
I could use an option to unbind finite geometry. Either you could describe it as making finite geometry infinite, or bound geometry unbound.
See screenshots below.
Thank you.
I could use an option to unbind finite geometry. Either you could describe it as making finite geometry infinite, or bound geometry unbound.
See screenshots below.
Thank you.
- Attachments
-
- Bound or finite geometry.jpg (205.25 KiB) Viewed 19360 times
-
- Unbound or infinite geometry.jpg (219.32 KiB) Viewed 19360 times
Last edited by Daniel4 on Wed Oct 26, 2022 12:04 am, edited 2 times in total.
Re: turn finite or bound geometry to infinite or unbound geometry
Hi,
if it is limited to horizontal/vertical lines and arcs then you can already do that in QCAD.
if it is limited to horizontal/vertical lines and arcs then you can already do that in QCAD.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: turn finite or bound geometry to infinite or unbound geometry
Hi,
May I ask why? Isn't it much easier to use XLines, Circles and so on to start with?
A script could be an answer for Lines, Arcs, Ellipse arcs, single segment Polylines and there it would end.
I don't see a way for an infinite Polyline or Spline.
Should that consider a selection or all displayed or both?
I think that whole the drawing is a bad option.
A workaround would be to draw over Lines by XLines and Arc's by circles.
That is what a script would do.
And then I don't consider a 360° degree arc to be the equivalent of a circle.
Regards,
CVH
May I ask why? Isn't it much easier to use XLines, Circles and so on to start with?
A script could be an answer for Lines, Arcs, Ellipse arcs, single segment Polylines and there it would end.
I don't see a way for an infinite Polyline or Spline.
Should that consider a selection or all displayed or both?
I think that whole the drawing is a bad option.
A workaround would be to draw over Lines by XLines and Arc's by circles.
That is what a script would do.
And then I don't consider a 360° degree arc to be the equivalent of a circle.
Regards,
CVH
Re: turn finite or bound geometry to infinite or unbound geometry
Hi Husky,
if this is possible to do already, awesome! how? I forgot to ask earlier if this is a feature that I just couldn't locate....
Hi CVH,
I'm going to admit, it's pretty rare. The only example I can think of is when you are working on someone else's file, and there are say 50 diameters. I want them to each be one entity for ease of programming, but find out that each one is broken into 10+ entities. Easiest fix is to select all arcs, then unbind all arcs/radii to make them full diameters. Last, delete all duplicates. Yeah, that's pretty rare, but it happens to me!
Yes, lines and arcs only, I really don't think it would work for anything else.
I don't know how scripts work, but I'm interested.
What is the difference between a 360 degree arc and a circle, start and end points?
Thanks for your help guys!
if this is possible to do already, awesome! how? I forgot to ask earlier if this is a feature that I just couldn't locate....
Hi CVH,
I'm going to admit, it's pretty rare. The only example I can think of is when you are working on someone else's file, and there are say 50 diameters. I want them to each be one entity for ease of programming, but find out that each one is broken into 10+ entities. Easiest fix is to select all arcs, then unbind all arcs/radii to make them full diameters. Last, delete all duplicates. Yeah, that's pretty rare, but it happens to me!
Yes, lines and arcs only, I really don't think it would work for anything else.
I don't know how scripts work, but I'm interested.
What is the difference between a 360 degree arc and a circle, start and end points?
Thanks for your help guys!
Re: turn finite or bound geometry to infinite or unbound geometry
Piece of cake ...
1. Use Selection Filter to find all finite horizontal lines:
Filter = Line, Angle, equal to, 0
click "Replace current Selection,
to find all horizontal direction repeat with similar Filter,
change Comparison to "not equal to" 0,
click "Add to current Selection"
2. Menu/Misc/Information/Store Positions (the position of all selected entities are stored within QCAD!),
3. Launch "Horizontal Linie", Mode Infinitive,
4. Launch "Use Positions" below Misc/Information,
5. press "Delete" to get rid of the still selected finite horizontal lines - done.
For finite vertical lines same procedure ... but with 90°
Tomorrow I will explain how to do it with arcs ....
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: turn finite or bound geometry to infinite or unbound geometry
Hi,
It would not be that hard to alter this: https://www.qcad.org/rsforum/viewtopic. ... 244#p32244 so it acts on Line segments or on arc's.
There is even an easy way back from an XLine or a Ray to a Line segment.
For your use the question still remains what Line segment as XLine will be detected by MD.
MD doesn't act on XLines or Rays.
For a circle all start/end data of the original arc is lost.
Resembling infinite shapes for Arcs is rather simple.
Select all Arcs.
For all set Reversed or not.
For all set Start Angle to 0 degree.
For all set End Angle to 360 degrees.
Invoke MD and delete duplicates.
But that are still Arc entities, full circular Arcs to be correct.
Select all full Arcs.
Polyline from selection.
Then run the code in the link above.
How this works: A circular Polyline can not be coded as one circular arc segment there the bulge factor would be infinite.
QCAD will split up the circular arc segment in two semi circles and stored these as one Polyline.
The script is intended for a way back from exploding Circles into Polylines.
Regards,
CVH
It would not be that hard to alter this: https://www.qcad.org/rsforum/viewtopic. ... 244#p32244 so it acts on Line segments or on arc's.
There is even an easy way back from an XLine or a Ray to a Line segment.
For your use the question still remains what Line segment as XLine will be detected by MD.
MD doesn't act on XLines or Rays.
For a circle all start/end data of the original arc is lost.
Resembling infinite shapes for Arcs is rather simple.
Select all Arcs.
For all set Reversed or not.
For all set Start Angle to 0 degree.
For all set End Angle to 360 degrees.
Invoke MD and delete duplicates.
But that are still Arc entities, full circular Arcs to be correct.
Select all full Arcs.
Polyline from selection.
Then run the code in the link above.
How this works: A circular Polyline can not be coded as one circular arc segment there the bulge factor would be infinite.
QCAD will split up the circular arc segment in two semi circles and stored these as one Polyline.
The script is intended for a way back from exploding Circles into Polylines.
Regards,
CVH
Last edited by CVH on Tue Oct 25, 2022 5:03 am, edited 6 times in total.
Re: turn finite or bound geometry to infinite or unbound geometry
That would add all Line segments with an angle not zero to my selection.
Meaning all from 0 to 360 degrees excluding zero itself but those were already selected in the previous step.
I think that 'Horizontal' is twofold: Those angled zero degrees and those angled 180 degrees.
'Vertical' is then 90 and 270 degrees.
Regards
CVH
Re: turn finite or bound geometry to infinite or unbound geometry
Bitte:
Tick 'SELECT ALL', copy and save it as a *.js script file (eg. Arc2Circ.js)
Run it in QCAD on a selection with Menu Misc .. Development .. Run Script (XC).
MD can then eliminate duplicates.
Tick 'SELECT ALL', copy and save it as a *.js script file (eg. Arc2Circ.js)
Run it in QCAD on a selection with Menu Misc .. Development .. Run Script (XC).
Code: Select all
// Arc segments to Circles script by CVH
var doc = getDocument();
var di = getDocumentInterface();
var arcsCollected = [];
// Retrieve the selection:
var ids = doc.querySelectedEntities();
// Terminate without selection:
if (ids.length === 0) {
EAction.handleUserWarning("Nothing Selected! Script terminated.");
return;
}
// Filter Arc segments from selection:
for (var i=0; i<ids.length; i++) { // Cycle selected entities
// Get entity from the document:
var entity = doc.queryEntity(ids[i]);
// Collect when exist and is Arc shape with a radius:
if (!isNull(entity)){
if (isArcEntity(entity)) {
if (!RMath.fuzzyCompare(entity.getRadius(), 0.0)) {
arcsCollected.push(ids[i]);
}
}
}
} // Loop selected entities
// Terminate without Arc segments in selection:
if (arcsCollected.length === 0) {
EAction.handleUserWarning("No Arc segments selected! Script terminated.");
return;
}
// Setup an operation:
var operation = new RModifyObjectsOperation();
operation.setText("Arcs to Circles");
// Process collected Arcs:
for (var i=0; i<arcsCollected.length; i++) { // Cycle collected Arcs
// Get Arcs from the document:
var arcEntity = doc.queryEntity(arcsCollected[i]);
var centerRv = arcEntity.getCenter();
var radius = arcEntity.getRadius();
// Create a new Circle entity:
var newCircle = new RCircleEntity(
doc,
new RCircleData(
centerRv,
radius
)
);
// Add the new Circle to the operation:
operation.addObject(newCircle, false, true); // NOTuseCurrentAttributes, DOforceNew
// Mark the Arc to delete:
operation.deleteObject(arcEntity);
} // Loop collected Arcs
// Apply all modifications:
di.applyOperation(operation);
// Finished:
var msg = "Created " + arcsCollected.length + " Circle entity/ies."
EAction.handleUserInfo(msg);
EAction.handleUserMessage("Script ended.");
return;
Re: turn finite or bound geometry to infinite or unbound geometry
The arc procedure ...
Use the Selection Filter to select all arcs,
after all arcs are selected check the Property Editor for "Sweep Angle" - set that to 360. Press Enter.
Note: If arcs are found which contain 10+(?) broken pieces this method will create 10+ 360° arcs (looks like a circle) at the same position = duplicates!
To fix that use the still existing selection on all arcs, launch "Detect Duplicates", Options like screenshot:
Hit "Delete Selected Duplicates" - done.
Broken into 10+ entities is a not before mentioned fact but luckily QCAD Pro can handle that too ...
Use the Selection Filter to select all arcs,
after all arcs are selected check the Property Editor for "Sweep Angle" - set that to 360. Press Enter.
Note: If arcs are found which contain 10+(?) broken pieces this method will create 10+ 360° arcs (looks like a circle) at the same position = duplicates!
To fix that use the still existing selection on all arcs, launch "Detect Duplicates", Options like screenshot:
Hit "Delete Selected Duplicates" - done.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: turn finite or bound geometry to infinite or unbound geometry
The problem in setting the Sweep Angle to 360 degrees is that there will be start/end angles over 360 degrees.
When we reload such files some full circular Arcs may have a Sweep Angle of 0 degrees.
They look OK but when selecting they are not displayed.
Some third-party Apps can not handle these. One of the reasons that I don't consider a 360° degree arc to be the equivalent of a circle.
So far I didn't encounter issues with Arcs going from 0 to 360 degrees.
Regards,
CVH
When we reload such files some full circular Arcs may have a Sweep Angle of 0 degrees.
They look OK but when selecting they are not displayed.
Some third-party Apps can not handle these. One of the reasons that I don't consider a 360° degree arc to be the equivalent of a circle.
So far I didn't encounter issues with Arcs going from 0 to 360 degrees.
Regards,
CVH
Re: turn finite or bound geometry to infinite or unbound geometry
Wow.
Thank you guys for the amount of work you both put into this. Next time you see me post something, give it a little less priority!
I'm impressed with all of this, the .JS file is crazy! How do you do that?
I like the store/use positions functions, this will come in handy for sure!
Last, I've never used the selection filter before, it looks very exhaustive, which is a good thing! Looks like I get to explore all of these items more in depth...
Thank you!
Thank you guys for the amount of work you both put into this. Next time you see me post something, give it a little less priority!
I'm impressed with all of this, the .JS file is crazy! How do you do that?
I like the store/use positions functions, this will come in handy for sure!
Last, I've never used the selection filter before, it looks very exhaustive, which is a good thing! Looks like I get to explore all of these items more in depth...
Thank you!
Re: [Solved] turn finite or bound geometry to infinite or unbound geometry
Your welcome, glad to be of any assistance.
More information on classes here: https://qcad.org/doc/qcad/3.0/developer/annotated.html
It would take about a 5 minutes rewrite each for Line2Ray or Line2XLine or back.
But because MD doesn't handle these it will be of no use for this topic.
What it stores for Polyline and Spline entities is by preference, see App.Prefs. .. Info .. Store Positions
Omitted is that:
- it stores the center of Arc, Circle, Ellipse and Ellipse Arc entities.
(What is of no use for this topic because the radii are dropped)
- it stores the position of a Block Reference and Text entities, the definition point for Dimensions.
- for Leaders it stores every node.
- and for other things like hatches, images and so on it stores the center of a bounding box.
Regards,
CVH
Upcoming postings are treated with the same interest.
All open source methods of QCAD can be found here: https://github.com/qcad/qcad
More information on classes here: https://qcad.org/doc/qcad/3.0/developer/annotated.html
It would take about a 5 minutes rewrite each for Line2Ray or Line2XLine or back.
But because MD doesn't handle these it will be of no use for this topic.
Tutorial: https://www.ribbonsoft.com/en/tutorial- ... -positions
What it stores for Polyline and Spline entities is by preference, see App.Prefs. .. Info .. Store Positions
Omitted is that:
- it stores the center of Arc, Circle, Ellipse and Ellipse Arc entities.
(What is of no use for this topic because the radii are dropped)
- it stores the position of a Block Reference and Text entities, the definition point for Dimensions.
- for Leaders it stores every node.
- and for other things like hatches, images and so on it stores the center of a bounding box.
Regards,
CVH