Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/15/2019 in all areas

  1. Maybe turn the turbo waste gate shut to see what will happen. Answer all hell broke loose for about 1 second. I have screwed Autocad just playing with menu's hate to think if start playing with unknown setvars.
    1 point
  2. Better to be recovering in your own man-cave than in a place where everybody wants your blood and stick needles in you all the time (and make you pay for it as well! the nerve of some people!) Some biological processes may have slowed you down or stopped this past week but nevertheless your creativity & (digital) productivity has been great hope your suffering will be over soon
    1 point
  3. I've used Jimmy Bergmark's code since he first posted it saved as "BackgroundChanger.LSP". We often get drawings from consultants with dark linework that can only be displayed on a white background. When Lee Mac posted his color conversion code I replaced everything above: ; Set the background in model and paper space to grey with: ;;; E-mail: info@jtbworld.com ;;; http://jtbworld.com/autocad-backgroundchanger-lsp ;;; 2003-07-01 - First release ;;; (load "BackgroundChanger.LSP") bgtg ;;; Macro: ^P(or bgtg (load "BackgroundChanger.LSP"));bgtg ;;; RCDATA_16_COLOR ;; RGB -> OLE - Lee Mac - Args: r,g,b - [int] Red, Green, Blue values ;; http://www.lee-mac.com/colourconversion.html#rgbole ;; ex. (LM:RGB->OLE 33 40 48) returns 3156001 (defun LM:RGB->OLE ( r g b )(logior (fix r) (lsh (fix g) 8) (lsh (fix b) 16))) ;; OLE -> RGB - Lee Mac - Args: c - [int] OLE Colour (defun LM:OLE->RGB ( c )(mapcar '(lambda ( x ) (lsh (lsh (fix c) x) -24)) '(24 16 8))) ;; ex. (LM:OLE->RGB 3156001) returns (33 40 48) Once it's loaded entering (LM:RGB->OLE 230 230 219) returns 14411494 Since I use the standard 33,40,48 as my BGGrey Background color I added the function: ; Background toggle between grey and white (defun c:bgtg () (vl-load-com) (setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object)))) (setq drafting (vla-get-drafting (vla-get-preferences (vlax-get-acad-object)))) (if (= (vlax-variant-value (vlax-variant-change-type (vla-get-graphicswinmodelbackgrndcolor disp) vlax-vblong ) ) (LM:RGB->OLE 33 40 48) ) (c:BGWhite) (c:BGGrey) ) (princ) ) which is just his bgt function modified to toggle to grey instead of black.
    1 point
  4. Attached is updated lisp. plo2.lsp
    1 point
  5. You could do the same in excel to calculate the number But this line is required to change (setq disp (vla-get-display (vla-get-preferences (vlax-get-acad-object)))) any of the properties. There is probably a registery setting somewhere. But again do you use lisp to change.
    1 point
  6. Congratulations, you've hit three figures I was going to add this ;; based on Doug Broad's round Function (defun rnd2dp ( val dp ) (setq dp (/ 1.0 (expt 10.0 (abs dp)))) (* dp (fix (/ ((if (minusp val) - +) val (* dp 0.5)) dp)))) and change this line to (setq pt (mapcar '(lambda (x) (rnd2dp (atof x) dec)) (list (nth 0 t_lst) (nth 1 t_lst) (nth 2 t_lst)))
    1 point
  7. in place of atof you could use 'datof' (defun datof (s i / n ) (if (and (= (type s) 'str) (numberp i) (setq n (vl-string-position (ascii ".") s))) (substr s 1 (+ 1 i n)) s)) test (datof "12345.67890" 2) where 2 is the number of decimals (dec in your routine) if data integrity is guaranteed : (defun datof (s i) (substr s 1 (+ 1 i (vl-string-position (ascii ".") s))))
    1 point
  8. Thanks @rlx, glad it helps.
    1 point
  9. You may wish to consider the following code: (defun c:c2xl ( / *error* col enx flg hed idx lst row sel typ xls xlsapp xlscls xlswbk xlswbs xlswsh ) (setq hed '("Rank" "Length" "Type")) ;; Column headings (defun *error* ( msg ) (if (and flg (= 'vla-object (type xlsapp))) (vl-catch-all-apply 'vlax-invoke-method (list xlsapp 'quit)) ) (foreach obj (list xlscls xlswsh xlswbk xlswbs xlsapp) (if (and (= 'vla-object (type obj)) (not (vlax-object-released-p obj))) (vlax-release-object obj) ) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (and (setq sel (ssget '((0 . "ARC,CIRCLE")))) (setq xls (getfiled "Create Excel File" "" "xlsx;xls" 1)) ) ) ) ( (progn (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) typ (strcase (cdr (assoc 0 enx)) t) lst (cons (list (* (cdr (assoc 40 enx)) (if (= "circle" typ) (+ pi pi) (rem (+ pi pi (- (cdr (assoc 51 enx)) (cdr (assoc 50 enx)))) (+ pi pi)) ) ) typ ) lst ) ) ) (not (or (setq xlsapp (vlax-get-object "excel.application")) (and (setq xlsapp (vlax-create-object "excel.application")) (setq flg t) ) ) ) ) (princ "\nUnable to interface with Excel application.") ) ( t (setq xlswbs (vlax-get-property xlsapp 'workbooks) xlswbk (vlax-invoke-method xlswbs 'add) xlswsh (vlax-get-property xlswbk 'activesheet) xlscls (vlax-get-property xlswsh 'cells) ) (setq col 0) (foreach itm hed (vlax-put-property xlscls 'item 1 (setq col (1+ col)) itm) (vlax-put-property (vlax-get-property (vlax-variant-value (vlax-get-property xlscls 'item 1 col)) 'font ) 'bold :vlax-true ) ) (setq row 1) (foreach itm (vl-sort lst '(lambda ( a b ) (< (car a) (car b)))) (setq row (1+ row) col 0 ) (foreach val (cons (1- row) itm) (vlax-put-property xlscls 'item row (setq col (1+ col)) val) ) ) (if (and (< "11.0" (vlax-get-property xlsapp 'version)) (= (strcase (vl-filename-extension xls) t) ".xlsx") ) (vlax-invoke-method xlswbk 'saveas xls 51 "" "" :vlax-false :vlax-false 1 1) (vlax-invoke-method xlswbk 'saveas xls -4143 "" "" :vlax-false :vlax-false 1 1) ) (vlax-invoke-method xlswbk 'close :vlax-false) ) ) (*error* nil) (princ) ) (vl-load-com) (princ)
    1 point
×
×
  • Create New...