![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Coding Post your Coding for opensource projects here. |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| ||||
| ||||
One of the biggest hurdles, I think, to writing any kind of CAD/CAM app is going to be getting a handle on the geometry involved. I'm going to contribute a Visual Basic module which contains 26 different geometry functions. This module contains only 2D functions, but could easily be adapted for 3D. I'm putting this up here so that hopefully someone will find it useful. If anyone wants to add to it or update it, that's great. Just make sure and re-post it here so that others can benefit too. Scott |
|
#3
| ||||
| ||||
| This module is taken right out of NCPlot. Of course, NCPlot contains a lot more stuff... I can't give away everything! Here's a good challenge that would be a great addition to an open source project: Add cutter comp functions Create pocketing routines Okay, so that's two challenges, but I think both could be done using the building blocks provided by this module. Scott |
|
#5
| |||
| |||
| Thank you very much! it is very helpful library. the only thing that i can't find anywhere is a function that receive 2 lines (2 points that defines each line) and a radius. the function returns the points of tangency. it is for a fillet feature that I'm trying to build in vb. |
| Sponsored Links |
|
#6
| |||
| |||
| Try something like this: Notes: - The endpoint of Line1 must be the startpoint of Line2. (<-- EDIT: Is not the same, it's the startpoint )- The input is Line1,Line2 and Radius.R - Return: Fill Radius with the rest of parameters (Radius.S,Radius.E,Radius.C,Radius.D) (coypaste of the user types) Code: Type dPoint
X As Double
Y As Double
End Type
Type dLine
S As dPoint 'Start Point
E As dPoint 'End Point
End Type
Type dArc
S As dPoint 'Arc Start Point
E As dPoint 'Arc End Point
C As dPoint 'Arc Center Point
R As Double 'Arc Radius
D As Integer 'Arc Direction (2=CW, 3=CCW)
End Type
Public Sub GetRadiusParms(Line1 As dLine, Line2 As dLine, Radius As dArc)
Dim D1u As dPoint
Dim D2u As dPoint
Dim rs As Double
Dim q As Double
D1u.X = Line1.E.X - Line1.S.X
D1u.Y = Line1.E.Y - Line1.S.Y
q = Sqr(D1u.X ^ 2 + D1u.Y ^ 2)
D1u.X = D1u.X / q
D1u.Y = D1u.Y / q
D2u.X = Line2.E.X - Line2.S.X
D2u.Y = Line2.E.Y - Line2.S.Y
q = Sqr(D2u.X ^ 2 + D2u.Y ^ 2)
D2u.X = D2u.X / q
D2u.Y = D2u.Y / q
q = Radius.R * (D1u.X * D2u.Y - D1u.Y * D2u.X) / (1 + D1u.X * D2u.X + D1u.Y * D2u.Y)
If q < 0 Then
rs = -Radius.R
Radius.D = 2
q = -q
Else
rs = Radius.R
Radius.D = 3
End If
Radius.S.X = Line1.E.X - q * D1u.X
Radius.S.Y = Line1.E.Y - q * D1u.Y
Radius.E.X = Line1.E.X + q * D2u.X
Radius.E.Y = Line1.E.Y + q * D2u.Y
Radius.C.X = Radius.S.X - rs * D1u.Y
Radius.C.Y = Radius.S.Y + rs * D1u.X
End Sub ![]() Good luck! Last edited by _Eduardo_; 06-20-2010 at 10:11 AM. |
|
#8
| |||
| |||
| It works! Thank you. I will explain my motivation: I'm trying to draw the data from your code to the screen (and then to a file) . I need to use only points (every 2 points i draw as a line on the screen - so i will be able to see what i am going to cut. my diamond turning cnc can only accepts points files). I'm using the circle equation to find the z for each x (i'm using your points as start point for the fillet. right now the only thing that works properly is your code |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |