Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/21/2020 in all areas

  1. Linking to other drawings is possible, but not as simple as just an entmake function. Maybe this will tell you how much effort is put to access drawings from another drawing. Purge the current block first in the current drawing though.
    1 point
  2. Or actually, if you want to inspect the properties of that block, simply use (vla-get- followed by the property you want to inspect. For example, a block has an insertion point and effective name, so you can do (vla-get-InsertionPoint p1) or (vla-get-EffectiveName p1). When you inspect the VLA block, you get a full list of properties you want to get.
    1 point
  3. (setq p3 (vlax-invoke p1 'GetAttributes)) And if your block has attribute(s), it will return a list of all the VLA-Object representing each attribute of the selected block, including its tag name, text string, etc... But if the object you select at p1 doesn't have the GetAttributes method, then the above will fail because you're trying to invoke a method on an object that doesn't actually support that method. You can find out what methods are supported for a object by using vlax-dump-object... For example: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) And all the properties and methods will be printed into the console.
    1 point
  4. I doubt this could done any any current release of acad
    1 point
  5. (if (tblsearch "BLOCK" blkname) (Make_bubble) (princ "NOT FOUND!") )
    1 point
  6. Can be shorten like: (if (tblsearch "BLOCK" blkname) (PRINC "FOUND") ; block exists (Make_bubble) ) As long as the condition to test returns anything other than nil, the "true" expression will be evaluated.
    1 point
  7. Have a look at this example full code attached.Pt num bubble.lsp (if (/= (tblsearch "BLOCK" blkname) NIL) (PRINC "FOUND") ; block exists (Make_bubble) )
    1 point
  8. Why so complicated? Try this (defun c:test ( / e1 e2 v1lst v2lst min_dist av bv) (setq e1 (car (entsel "\nSelect First Polyline : ")) e2 (car (entsel "\nSelect First Polyline : ")) v1lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e1))) v2lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e2))) min_dist 1.0e99 av nil bv nil ) (foreach y v1lst (mapcar '(lambda (x) (if (< (distance y x) min_dist) (setq min_dist (distance y x) av y bv x))) v2lst)) (entmakex (list '(0 . "LINE") (cons 10 av) (cons 11 bv) '(62 . 1))) (princ (strcat "\nMin Inter Vertex Distance Poly 1 to Poly 2 : " (rtos min_dist 2 3))) ) It will draw a red line between two vertices and print the distance on the command line
    1 point
  9. since you are coder, my $0.05 optimization. when prompt password, it would be friendlier if user gets notified [Caps-Lock ON/OFF] 1.Easy: Echo to the the screen entmake Text dynamic entmod. (advance may consider - Textbox , GrText or Textmask ) 2.Advanced: create Attributed block update value 3.Expert: If MacOS supports Actable? emulate table as dialog box, column width=row height as Grid, customize merge cell as edit cell & buttoms. hittest 4.or slide vector image? as participant, i personal vote for Lee's because bonus [<--Backspace] compatibility & excludes includes loop for [Function] keys. though just minor spacer bug. (to replicate, just key-in all spaces then Backspace. notice the pipe "|" walks away) p/s: Ron's dcl is more practical but excluded due to OP's query w/o DCL v1.1 revision ;backspace ;expr - quoted list expression for additional functionality use 'STR' as token ;example: you make a fake dialog box using attributed block, Tag name is "KEY", ;you use your-att-func which can replace or vla-put-textstring the token 'STR' ;(foo "•" 20 '(your-att-func blk (list (cons "KEY" (strcat (substr STR 10) "|")))) ) ;for normal usage just put nil for expression ;(foo (chr 149) 20 nil) (defun foo ($ n expr / l k str x) ;;hp:pword 16.04.2020 (terpri) (princ (setq x t str "Password: " ! str ) ) (while (and x (setq k (grread nil))) (if (and (= (car k) 2) (numberp (setq x (cadr k))) (or (= 8 x) (<= 32 x 127)) ;; (< (length l) n) ) (progn (princ (strcat "\r" (setq str (if (= x 8) (if (> (strlen str) (strlen !)) (substr str 1 (1- (strlen str))) ! ) (strcat str $) ) ) ) ) (setq l (if (= x 8) (if (> (length l) 0) (cdr l) l ) (cons x l) ) ) (eval expr) ) (setq x nil) ) ) (vl-list->string (reverse l)) ) ;example: you make a fake dialog box using attributed block, Tag name is "KEY", ;you use your-att-func which can replace or vla-put-textstring the token 'STR' (foo "•" 20 '(your-att-func blk (list (cons "KEY" (strcat (substr STR 10) "|")))) )
    1 point
  10. How long are you going to be working there a simple password is a time bomb that the lisp/fas stops working, unless you have smart people it can be as simple as using "setenv". Then count down number of tries or check date. If you have your own web server can read a license file so could be as simple as 1 line "OK" 99.99 % of people have no idea how to get around software has stopped working. (if (= (setq alancnt (getenv "xxxx")) nil) (progn (setenv "xxxx" "0") (alert "Your trial has started\n \n You have 50 times that you can use the software\n \n Contact Email info@alanh.com.au\n \n for further information.") ) (progn (setq alancount (+ (atoi alancnt) 1)) (setenv "xxxx" (rtos alancount 2 0)) (alert (strcat "You have " (rtos (- 50 alancount) 2 0) " repeat to go")) ) ) (if (>= alancount 50) (progn (alert "Your trial number has finished \n \n You need to contact\n \n Alanh Consulting \n \n Email info@alanh.com.au") (exit) ) )
    1 point
  11. Try this. It is an old version. (defun pass (/ sir init_par numar $$sir lgr $sir n) (prompt "\nPassword, please: ") (setq init_par (list 67 48 110 115 117 115) $$sir T) ;;->C0nsus (Czeronsus) (while $$sir (if (and (setq numar (grread nil 4 1))(= (car numar) 2)) (cond ((and (/= (cadr numar) 8)(/= (cadr numar) 13)) (setq sir (append sir (list (cadr numar)))) (princ "*") ) ;I ((= (cadr numar) 8) (setq lgr (length sir) n 0 $sir nil) (if (> lgr 0)(write-char 8)) (while (< n (- lgr 1)) (setq $sir (append $sir (list (nth n sir))) n (1+ n)) ) (setq sir $sir) ) ;II (T (setq $$sir nil)) ;III ) ) ) (if (equal init_par sir) T) )
    1 point
  12. AutoDesk dropped the RENTAL price. You can no longer purchase a perpetual license. If money is of concern there is always the FREE 2D CAD program called Draftsight.
    1 point
×
×
  • Create New...