Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/02/2023 in all areas

  1. Give this a try: (defun c:c2l (/ ad b l ln) ;; RJP » 2023-10-02 (setq ad (vla-get-activedocument (vlax-get-acad-object))) (vlax-for x (vla-get-layers ad) (setq l (cons (vla-get-name x) l))) (vlax-for a (vla-get-blocks ad) (vlax-for b a (if (vl-position (setq ln (vla-get-layer b)) l) (progn (entmod (append (entget (tblobjname "layer" ln)) (vl-remove-if-not '(lambda (x) (member (car x) '(62 420 430))) (entget (vlax-vla-object->ename b)) ) ) ) (setq l (vl-remove ln l)) ) ) (vl-catch-all-apply 'vla-put-color (list b 256)) ) ) (princ) )
    1 point
  2. When storing doubles as strings, I like to use a function such as this - ;; Number to String - Lee Mac ;; Converts a supplied numerical argument to a string (defun LM:num->str ( num / dim rtn ) (if (equal num (atoi (rtos num 2 0)) 1e-8) (rtos num 2 0) (progn (setq dim (getvar 'dimzin)) (setvar 'dimzin 8) (setq rtn (rtos num 2 15)) (setvar 'dimzin dim) rtn ) ) ) This ensures that the supplied number is stored to the maximum precision afforded by the double precision floating point format, but in the shortest string necessary to represent the number to the maximum available precision (e.g. integers are stored as integers, doubles have all trailing zeroes removed).
    1 point
  3. Force for exemple your storage with (setenv "myvar" (rtos 0.5 2 1))
    1 point
  4. Thank you so much for your time Steven P, this is exactly what I was after. It works great.
    1 point
  5. Untested, but should work... Otherwise, good start point for develop... (defun c:stripptscur-lin ( / ss s1 i pt pl c dists len p ) (vl-load-com) (prompt "\nSelect curve with points that lie on it...") (if (setq ss (ssget)) (progn (sssetfirst nil ss) (setq s1 (ssget "_I" '((0 . "POINT")))) (sssetfirst) (repeat (setq i (sslength s1)) (setq pt (ssname s1 (setq i (1- i)))) (ssdel pt ss) (setq pl (cons (cdr (assoc 10 (entget pt))) pl)) ) (setq c (ssname ss 0)) (setq pl (vl-sort pl '(lambda ( a b ) (< (vlax-curve-getparamatpoint c a) (vlax-curve-getparamatpoint c b))))) (foreach p pl (setq dists (cons (vlax-curve-getdistatpoint c p) dists)) ) (setq len (vlax-curve-getdistatparam c (vlax-curve-getendparam c))) (initget 1) (setq p (getpoint "\nPick or specify point to place line : ")) (entmake (list (cons 0 "LINE") (cons 10 p) (cons 11 (polar p 0.0 len)))) (foreach dist (reverse dists) (entmake (list (cons 0 "POINT") (cons 10 (polar p 0.0 dist)))) ) ) ) (princ) ) HTH. M.R.
    1 point
  6. The general term is an oblique projection. It is a parallel projection but the projection lines used to create it are parallel to each other but not perpendicular to the viewing plane (as they are with an isometric drawing and other axonometric projections). If the scale is the same in the diagonal direction as it is in the horizontal and vertical direction than it is a cavalier projection. If the third dimension is scale by 1/2 then it is referred to as a cabinet projection. https://en.wikipedia.org/wiki/Oblique_projection
    1 point
  7. Try this change to Emmanuel Delay - though he might have better ideas of course The tags to change are in 2 lists - bit there is no checking that the 2 lists are the same length or valid attribute tags. As BigAl above, a more versatile approach might be select source, select tags, select destination, select tags - though that would need a bit more work to reduce user errors (vl-load-com) ;; To copy/paste from fixed attributes, source tag: "SIGLA", destination tag: "NAME" ;; TTC Block (defun c:ttcb ( / sText) ;;ADDED SOURCE and DESTINATION (setq source_list (list "SIGLA" "SIGLA1")) (setq final_destination (list "NAME" "NAME1")) (defun TCC_copyAttribute (source blk / ) ; (if (setq blk (entsel "\nSelect source block: ")) ;;REMOVED THIS LINE (setq sText (LM:vl-getattributevalue (vlax-ename->vla-object (car blk)) source)) ; ) ;; REMOVED THIS ) (defun TCC_pasteAttribute (dest blk / ) ; (if (setq blk (entsel "\nSelect destination block: ")) ;; REMOVED THIS LINE (LM:vl-setattributevalues (vlax-ename->vla-object (car blk)) (list (cons dest sText)) ) ; ) ;;REMOVED THIS ) (setq Source_blk (entsel "\nSelect source block: ")) (setq Destination_blk (entsel "\nSelect destination block: ")) (setq acount 0) (while (< acount (length source_list)) ; (while (TCC_copyAttribute "SIGLA") ;;REMOVED THIS LINE ; (TCC_pasteAttribute "NAME") ;;REMOVED THIS LINE (TCC_copyAttribute (nth acount source_list) Source_blk ) (TCC_pasteAttribute (nth acount final_destination) Destination_blk) ; ) ; end while ;;REMOVED THIS LINE (setq acount (+ acount 1)) ) ; end while ) ;; Get Attribute Value - Lee Mac ;; Returns the value held by the specified tag within the supplied block, if present. ;; blk - [vla] VLA Block Reference Object ;; tag - [str] Attribute TagString ;; Returns: [str] Attribute value, else nil if tag is not found. (defun LM:vl-getattributevalue ( blk tag ) (setq tag (strcase tag)) (vl-some '(lambda ( att ) (if (= tag (strcase (vla-get-tagstring att))) (vla-get-textstring att))) (vlax-invoke blk 'getattributes)) ) ;; Set Attribute Values - Lee Mac ;; Sets attributes with tags found in the association list to their associated values. ;; blk - [vla] VLA Block Reference Object ;; lst - [lst] Association list of ((<tag> . <value>) ... ) ;; Returns: nil (defun LM:vl-setattributevalues ( blk lst / itm ) (foreach att (vlax-invoke blk 'getattributes) (if (setq itm (assoc (vla-get-tagstring att) lst)) (vla-put-textstring att (cdr itm)) ) ) )
    1 point
  8. google came up with this link : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/calling-method-additems-of-interface-iacadselectionset-failed/td-p/863082
    1 point
×
×
  • Create New...