Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/01/2024 in all areas

  1. First impressions: Obviously there's a lot going on here. I don't consider myself an expert on AutoLISP, but I've dabbled in many languages. Anyone remember SNOBOL? APL? AutoLISP is not case sensitive, but using "Com" and "com" could confuse the casual reader (such as myself). Not only that, COM is the Component Object Model, which is a Microsoft thing you can use with AutoLISP; if that variable has nothing to do with COM, I'd use something else (again to avoid confusion). You can overload functions in AutoLISP, but I think you have to use different argument lists. Since there are two definitions of FAS here with the same argument list, the first one will be ignored. Since the code is different, I'm not sure which one to discuss. I have not seen the command-s keyword before. Interesting. Wouldn't (logand 1 (getvar 'CMDACTIVE)) be equivalent to (eq (logand 1 (getvar 'CMDACTIVE)) 1)? Wait, no it isn't. This is the kind of thing that trips me up. Welcome to the forum! A better programmer will be along shortly to help you.
    1 point
  2. Thanks for the generous offer... but: I glad to help, Duke! That's the reason we are here: to get and to offer help. If you like our forum, hang on here, get yourself involved in discussions, offer your advice to novice users. I wish you a nice day!
    1 point
  3. This is what I have, basically the same thing posted. (vlax-invoke (vlax-get (vlax-get (setq html (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'setData "Text" sText) (vlax-release-object html) ;release the html bad things could happen another backwards way to do it if the htmlfile still isn't working for you. Run a power shell to create a text file and output the clipboard with Get-Clipboard to a text file then just read the text file.
    1 point
  4. (defun c:randlstcolcurv ( / *error* LM:randrange LM:rand cad doc alo spc collst sel i e o col ) (or (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil)) (vl-load-com)) (defun *error* ( m ) (while (= 8 (logand 8 (getvar (quote undoctl)))) (if doc (vla-endundomark doc) ) ) (if doc (vla-regen doc acactiveviewport) ) (if m (prompt m) ) (princ) ) ;; Random in Range - Lee Mac ;; Returns a pseudo-random integral number in a given range (inclusive) (defun LM:randrange ( a b ) (+ (min a b) (fix (* (LM:rand) (1+ (abs (- a b)))))) ) ;; Rand - Lee Mac ;; PRNG implementing a linear congruential generator with ;; parameters derived from the book 'Numerical Recipes' (defun LM:rand ( / a c m ) (setq m 4294967296.0 a 1664525.0 c 1013904223.0 $xn (rem (+ c (* a (cond ($xn) ((getvar 'date))))) m) ) (/ $xn m) ) (or cad (setq cad (vlax-get-acad-object))) (or doc (setq doc (vla-get-activedocument cad))) (or alo (setq alo (vla-get-activelayout doc))) (or spc (setq spc (vla-get-block alo))) (if doc (vla-startundomark doc) ) (setq collst (list 1 5 8 9 15 25 31 24 52 64 85 93 72)) ;;; edit to suit your needs ;;; (if (setq sel (ssget (list (cons 0 "*LINE")))) (repeat (setq i (sslength sel)) (setq e (ssname sel (setq i (1- i)))) (setq o (vlax-ename->vla-object e)) (if (vlax-property-available-p o "Color" T) (progn (setq col (nth (LM:randrange 0 (1- (length collst))) collst)) (vlax-put-property o (quote color) col) ) ) ) ) (*error* nil) ) HTH. M.R.
    1 point
×
×
  • Create New...