Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/25/2022 in all areas

  1. That's It! From there I can format the information for how I will use it. Thanks again
    1 point
  2. No I wasn't clear. I updated the code above to calculate the angle on the YZ axis like you asked.
    1 point
  3. Check out the code and A23 is one of the other functions. ;------------------------------------------------------------------------------- ; ColumnRow - Returns a list of the Column and Row number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Cell$ = Cell ID ; Syntax example: (ColumnRow "ABC987") = '(731 987) ;------------------------------------------------------------------------------- (defun ColumnRow (Cell$ / Column$ Char$ Row#) (setq Column$ "") (while (< 64 (ascii (setq Char$ (strcase (substr Cell$ 1 1)))) 91) (setq Column$ (strcat Column$ Char$) Cell$ (substr Cell$ 2) );setq );while (if (and (/= Column$ "") (numberp (setq Row# (read Cell$)))) (list (Alpha2Number Column$) Row#) '(1 1);default to "A1" if there's a problem );if );defun ColumnRow ;------------------------------------------------------------------------------- ; Alpha2Number - Converts Alpha string into Number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Str$ = String to convert ; Syntax example: (Alpha2Number "ABC") = 731 ;------------------------------------------------------------------------------- (defun Alpha2Number (Str$ / Num#) (if (= 0 (setq Num# (strlen Str$))) 0 (+ (* (- (ascii (strcase (substr Str$ 1 1))) 64) (expt 26 (1- Num#))) (Alpha2Number (substr Str$ 2)) );+ );if );defun Alpha2Number ;------------------------------------------------------------------------------- ; Number2Alpha - Converts Number into Alpha string ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Num# = Number to convert ; Syntax example: (Number2Alpha 731) = "ABC" ;------------------------------------------------------------------------------- (defun Number2Alpha (Num# / Val#) (if (< Num# 27) (chr (+ 64 Num#)) (if (= 0 (setq Val# (rem Num# 26))) (strcat (Number2Alpha (1- (/ Num# 26))) "Z") (strcat (Number2Alpha (/ Num# 26)) (chr (+ 64 Val#))) );if );if );defun Number2Alpha
    1 point
  4. Kreaten_vhar what industry are you in ? Stepehen P my autoload.lsp has just that "Autoload" is a valid command it only loads the lisp when you type its command name. (autoload "COPYCOMMAND" '("ZZZ")) so only loads when you type zzz
    1 point
  5. Just taking a shot and what I assume you're looking for: edit: forgot about the rounding part oops. Gonna see what I can do there if anything. edit2: Threw in Lee Mac's roundm function, but I haven't tested it. Still no fractions edit3: I think I broke it... You can change DISTR to DIST to just get the length with no rounding for now if you'd like, it'll work in that way. edit4: Fix'd-er up, and it displays fractions! (I'm also pretty sure the code could be a bit better. I change the data-type of DIST and DISTR probably needlessly) (defun LM:roundm (n m) ;gotta love Lee Mac (http://www.lee-mac.com/round.html) (* m (fix ((if (minusp n) - +) (/ n (float m)) 0.5))) ) (defun c:linelength (/ s e) ;function taken from helpful post by Tharwat @ https://www.cadtutor.net/forum/topic/55856-lisp-to-get-length-of-single-line/ (princ "\n Pick on one line to get its length :") (if (setq s (ssget "_+.:S:E" '((0 . "LINE")))) (progn (setq DIST (rtos (distance (cdr (assoc 10 (setq e (entget (ssname s 0))))) (cdr (assoc 11 e))) 2)) (setq DISTR (LM:roundm (distof DIST) 0.125)) (setq DISTR (rtos DISTR 5)) (command "TEXT" PAUSE PAUSE 90 DISTR) (princ) ) ) ) You select the line, then select where you want the text of the length to be placed, then choose a size for the text. It then plops it where you set with the 90* rotation applied. Hope that helps
    1 point
  6. Yeah, sure. Command TCCR. I let you first enter the width. Then, since you need that width multiple times I put the rest in a while loop. Of course you can hard code the width and remove the while if you want. ;; degrees to rad (defun deg2rad (deg / ) (/ (* deg pi ) 180) ) ;; draws a polyline (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) ;; TCCR for: Two Click Centerline Rectangle (defun c:TCCR ( / w ang p1 p2 bl br tl tr) (setq w (getreal "\nWidth: ")) (while (setq p1 (getpoint "\nPoint 1:")) (setq p2 (getpoint "\nPoint 2:" p1)) ;; calculate bottom/left, bottom/right,... (setq ang (angle p1 p2)) (setq bl (polar p1 (- ang (deg2rad 90.0)) (/ w 2.0))) (setq tl (polar p1 (+ ang (deg2rad 90.0)) (/ w 2.0))) (setq br (polar p2 (- ang (deg2rad 90.0)) (/ w 2.0))) (setq tr (polar p2 (+ ang (deg2rad 90.0)) (/ w 2.0))) (drawLWPoly (list bl br tr tl) 1) ) )
    1 point
×
×
  • Create New...