Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/15/2022 in all areas

  1. http://www.lee-mac.com/consistentrtos.html
    2 points
  2. Rather than drawing a bounding box you can get all the information you need from the textbox (AutoLISP) function. For merging all Text Styles to Arial Merge text styles (or change text styles) lisp version 4.2 by T.Willey is the bomb!
    2 points
  3. Thank you it did worked well on your previous version, this one is better, it seems that there's still a long way for me to go to get proficient in lisp (but working on it). Thanks a lot.
    1 point
  4. @ronjonp is right tho. it will just display as * if text is different. if you enter anything and hit enter they will all be changed.
    1 point
  5. Can't figure out how to get the xref entity name if you use nentsel on the line (trying to only use one selecton). so you have to pick the xref and then the line after the block is inserted. Never mind figured it out. Now you only need to select the line in the xref. (defun C:C2L (/ SS BP xref path blk line lay blk-entities pts-lst) (setvar "cmdecho" 0) (vl-cmdf "_.undo" "_begin") (prompt "\nSelect the object(s) to copy. ") (setq SS (ssget) BP (getpoint "\nSelect Base Point: ") ent (entsel "\nSelect Line") xref (car ent) line-pt (cadr ent) path (vla-get-path (vlax-ename->vla-object xref)) path (findfile (strcat (vl-filename-base path) (vl-filename-extension path))) ) (vl-cmdf "_Insert" (strcat "blk=" path) '(0 0 0) "" "" "") (setq blk (entlast) line (car (nentselp line-pt)) lay (cdr (assoc 8 (entget line))) blk-entities (vlax-invoke (vlax-ename->vla-object blk) 'explode) ) (foreach ent blk-entities (if (eq (vla-get-layer ent) lay) (setq pts-lst (cons (vlax-curve-getStartPoint ent) pts-lst) pts-lst (cons (vlax-curve-getendpoint ent) pts-lst) ) ) (vla-delete ent) ) (entdel blk) ;prob a good idea to purge the block too. (foreach PT pts-lst (vl-cmdf "_.Copy" SS "" BP PT) ) (vl-cmdf "_.undo" "_end") (setvar "cmdecho" 1) (princ) )
    1 point
  6. Code is not needed for this. Select all the text you want to change then update the contents in the properties palette (CNTRL+1).
    1 point
  7. Will work on text and mtext. ;;----------------------------------------------------------------------------;; ;; Select text to replace (defun C:Sel2Replace (/ SS str) (vl-load-com) (prompt "\nSelect Text") (setq ss (ssget '((0 . "*TEXT"))) newstr (getstring t "\nNew Text: ") ) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (vla-put-textstring (vlax-ename->vla-object ent) newstr) ) ) Shouldn't have got that coffee! @Emmanuel Delay
    1 point
  8. Sure. Like this? Command RMT. It also works for TEXT objects. If you don't want this, replace (cons 0 "TEXT,MTEXT") by (cons 0 "MTEXT") (vl-load-com) ;; RMT for Replace Mtext (defun c:rmt ( / ss newtext i) (princ "\nSelect TEXT/MTEXT elements: ") (setq ss (ssget (list (cons 0 "TEXT,MTEXT") ))) (setq newtext (getstring "\nNew text: " 1)) (setq i 0) (repeat (sslength ss) (vla-put-textstring (vlax-ename->vla-object (ssname ss i)) newtext) (setq i(+ i 1)) ) (princ) )
    1 point
  9. You would probably be interested to go to OPTIONS and then look at the SELECTION and DRAFTING tabs to help you understand what the variables do.
    1 point
  10. Lots of similar code out there but most like Steven P's set a list of properties to ByBlock and Layer 0 which is how most blocks are created. They exist and have the properties of whatever layer you put them on. Rather than adding code to pick a layer you want the block on why not just use code that places it on Layer 0, select the blocks and pick the layer you want it on? Another old lisp example with an author: ; Written By: Peter Jamtgaard 12/20/2006 ;^P(or C:BlkByBlock (load "BlkByBlock.lsp"));BlkByBlock (defun C:BlkByBlock (/ colBlockReference ActDoc dprSelection objSelection strBlockName ) (if (setq dprSelection (entsel "\nSelect Block: ")) (progn (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)) dprSelection (car dprSelection) objSelection (vlax-ename->vla-object dprSelection) ) (vla-StartUndoMark ActDoc) (BlkByBlock objSelection) (entupd dprSelection) (vla-EndUndoMark ActDoc) ) ) (prin1) ) (defun BlkByBlock (objSelection / colBlockReference objBlock strBlockName ) (if (= (type objSelection) 'ENAME) (setq objSelection (vlax-ename->vla-object objSelection))) (if (wcmatch (strcase (vla-get-objectname objSelection)) "*BLOCK*") (progn (vlax-for objBlock (vla-item (vla-get-blocks ActDoc) (vla-get-name objSelection) ) (vla-put-Color objBlock 0) (vla-put-Layer objBlock "0") (vla-put-linetype objBlock "ByBlock") (vla-put-Lineweight objBlock -1) (if(vla-get-Lineweight objBlock -1) ; (vla-put-PlotStyleName objBlock "ByBlock") (if(=(getvar 'PStyleMode)0)(vla-put-PlotStyleName objBlock "ByBlock")) ) ) ) (prin1) ) (prin1)
    1 point
  11. Also, Ctrl+Shift+Arrow will select whole words, and Ctrl+Bksp will delete whole words.
    1 point
×
×
  • Create New...