Andrew,
Husky provided a very nice demonstration for me and he was using Rays. I couldn't locate anything in the API documentation regarding Rays and the Line2P.js didn't help me.
Can I create a Ray using code?
Thanks,
Lori
Create a Ray in ECMA?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Create a Ray in ECMA?
Yes, you can create any supported entity type in scripts. Example ray that starts at 100,50 and extends towards the right (1,0). I.e. the second vector is a direction vector.
new RRayEntity(document, new RRayData(new RVector(100,50), new RVector(1,0));
-
- Full Member
- Posts: 84
- Joined: Sat Nov 03, 2012 2:00 am
Re: Create a Ray in ECMA?
I should have searched RRay in the documentation, it was there all along.
I tried to implement this and had some strange results. When I created horizontal guides using rays, I was able to use a circle intersection with them. My vertical guides made of rays don't work with the circle intersection.
You can see that the circle definitely intersects the rays. Here's the horizontal ones. There are two starting at the center out. The intersections are clear and found by QCAD. I understand that Rays are probably virtual, being infinite, but it's strange that some work and others don't. Any ideas?
Lori
I tried to implement this and had some strange results. When I created horizontal guides using rays, I was able to use a circle intersection with them. My vertical guides made of rays don't work with the circle intersection.
You can see that the circle definitely intersects the rays. Here's the horizontal ones. There are two starting at the center out. The intersections are clear and found by QCAD. I understand that Rays are probably virtual, being infinite, but it's strange that some work and others don't. Any ideas?
Lori
Re: Create a Ray in ECMA?
Please post the drawing file, thanks.
-
- Full Member
- Posts: 84
- Joined: Sat Nov 03, 2012 2:00 am
Re: Create a Ray in ECMA?
Andrew
Here's the dxf. It is being generated from one of my .js files. I just commented everything below the drawing of the circle out (since the next bit of code was the intersection call that fails).
Thank you,
Lori
Here's the dxf. It is being generated from one of my .js files. I just commented everything below the drawing of the circle out (since the next bit of code was the intersection call that fails).
Thank you,
Lori
- Attachments
-
- VertRays.dxf
- (99.6 KiB) Downloaded 506 times