Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/31/2019 in all areas

  1. As some CAD users have heard the free 2D CAD program Draftsight, by Dassault Systemes, will cease functionality at the end of 2019. For those of you looking for a replacement I offer the following. All four programs are available in Windows, Linus and Mac versions. Note that both Draftsight and NanoCAD also offer very low cost versions of their CAD programs if one is so inclined. FreeCAD https://www.freecadweb.org/ Open source LibreCAD https://librecad.org/ Open source NanoCAD https://nanocad.com/ QCAD v3.23 https://qcad.org/en Open source
    1 point
  2. There are two general mathematical approaches for calculating the center of the fillet radius (a1 in your figurer 3). One is to analytically solve for the intersection of a line and an arc. In this case the line will be a line offset from line pt1 pt2 by a distance r1 (the radius of the fillet). The center of the fillet will also be on an arc of radius equal to the fillet radius + given arc radius r = r1 + r2. This arc will have the same center as the given arc. Since a line may intersect an arc twice, part of the task is to determine which of the two possible solutions is the one you want. This can be done with a bias point determined from existing geometry or by the user specifying which solution is needed. Another method for finding the fillet center is to use numerical methods which use a sequence of systematic guesses to find a solution that is numerically satisfactory. I thought I'd have some fun with this problem and try a numerical solution. In the code below pt10 and pt 11 define the line offset from the line passing through pt1 pt2 by the distance r1. A unit vector perpendicular to line p1 p2 and pointing towards the arc center (ptctr) is used to determine the direction of the offset. The end of the offset line is used as an initial guess for the location of the center. This is the left most ptA. ptB is the intersection of the line from ptA to ptctr. ptB is then projected to line from pt10 to pt11> This defines a new ptA Step 1 above is repeated using the new ptA Step 2 is repeated to calculate a new ptB The process continues until the distance between the most recent values for ptA and ptB is less than a specified tolerance. I set this value to 0.00001 in the code below but it could be smaller or a percentage of some value (e.g., the extents). If a solution is not found in 100 tries the message "No Solution" is displayed. ; finds the center of a fillet given a line, arc, and fillet radius ; L. Minardi 10/30/2019 (defun c:ctrpoint (/) (command "_pdmode" "35" "") (setq osnp (getvar "osmode")) (setvar "osmode" 0) (setq r1 (getdist "\nEnter fillet radius") ss (entsel "\nSelect line") ed (entget (nth 0 ss)) pt1 (cdr (assoc 10 ed)) pt2 (cdr (assoc 11 ed)) ss (entsel "\nSelect arc") ed (entget (nth 0 ss)) ptctr (cdr (assoc 10 ed)) r2 (cdr (assoc 40 ed)) ; radius of arc perp12 (proj_pt pt1 pt2 ptctr) ; projection of arc center onto line uperp12 (normalize (mapcar '- ptctr perp12)) ; unit vector in direction of arc center pt10 (mapcar '+ pt1 (mapcar '* uperp12 (list r1 r1 r1))) ; offset line pt11 (mapcar '+ pt10 (mapcar '- pt2 pt1)) ptA pt10 ; start point for interation r (+ r1 r2) ; radius of arc with fillet center cont T ; while flag n 0 ; iteration counter ) ; ptB is at the intersetcion of the offset arc and line from ptA to arc center ; ptA is the projection of ptB onto the offset line. (while cont (setq ptB (mapcar '+ ptctr (mapcar '* (normalize (mapcar '- ptA ptctr)) (list r r r)) ) ) (setq ptA (proj_pt pt10 pt11 ptB)) (setq ptB (mapcar '+ ptctr (mapcar '* (normalize (mapcar '- ptA ptctr)) (list r r r)) ) ) (setq n (+ n 1)) (if (< (distance ptA ptB) 0.00001) (setq cont nil) ) ; end if (if (> n 100) (setq cont nil) ) ; end if ) ; end while (if (> n 100) (princ "\nNo Solution") (progn (princ "\fillet center = ") (princ ptB) (command "_point" ptB "") (princ "\iterations = ") (princ n) ) ) ; end if (setvar "osmode" osnp) ;reset osnap ;reset osnap (princ) ) ; end defun (defun normalize (p / d) ; normalize a vector (setq d (distance '(0 0 0) p)) (setq p (mapcar '/ p (list d d d))) ) ;;; calculates point of p projected to line defined by p1 and p2 (defun proj_pt (p1 p2 p / d u12 ) (setq d (distance p1 p2)) (setq u12 (mapcar '/ (mapcar '- p2 p1) (list d d d))) (setq d (dot u12 (mapcar '- p p1))) (setq pp (mapcar '+ p1 (mapcar '* u12 (list d d d)))) ) ;;; dot product of 2 vectors a and b (defun dot (a b / dd) (setq dd (mapcar '* a b)) (setq dd (+ (nth 0 dd) (nth 1 dd) (nth 2 dd))) )
    1 point
  3. @Pugazh Assuming I've understood what you are looking to achieve, is this program of use to you?
    1 point
  4. Limited in some ways but don't forget Bricsys Shape. It's the BricsCAD free software aimed at concept modelling it does 2D and 3D. Creates dwg files it's really easy to use the main limitations are no dims (apparently you can copy a dim from and external file and place and adjust those to get dims that way if you really want). And no Layouts but you can print to PDF to get 'views' out. But anything you create is saved as dwg and should you wish to then upgrade to BricsCAD for dims and Layouts, and more advanced stuff like sections even BIM data, it can all be done with the model you create in Shape, no need to make any changes.
    1 point
  5. I've updated the code to correct snapang of either (* (/ pi 2) 3) or (* (/ pi 2) -1).
    1 point
×
×
  • Create New...