Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/14/2022 in all areas

  1. Hi Taybac214 , haven't done much lisping lately but I have attached my latest version, still a couple of years old but it seems to be working here in AutoCad 2022. Maybe this will work for you else I have to take a closer look at where the problem might be. Probably somewhere in the ini section. Else load routine from the built in AutoCad lisp editdor , set it to stop on error and then use view last error so I have a better idea where it all goes wrong. CT.LSP
    2 points
  2. If your studying CAD then work out how to do it manually 1st. You need to use the Layout command, I would set up Layout 1 with a border and a mview 1st. You can then make new layouts go into mspace and zoom to correct title area. Ok now for your blocks you need to look at the block and get each for each one the corners of the title block, so you can use this in the new layout with a zoom. Looking at your blocks they are 1 block but different scales. This is what layouts are for, you have a title at true scale 1:1 then have a mview inside it, then using mspace you set a scale for that viewport, this is contradictory to what you want but for me perhaps others the right approach, hence no code.
    2 points
  3. And another that allows a pick of any part of the dimension (defun c:foo (/ e el m p1 p2) (if (and (setq e (car (entsel "\nPick dimension: "))) (progn (vlax-for a (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (cdr (assoc 2 (entget e))) ) (and (= "AcDbMText" (vla-get-objectname a)) (setq m (vlax-vla-object->ename a))) ) m ) (setq p1 (cdr (assoc 10 (setq el (entget m))))) (setq p2 (getpoint p1 "\nSpecify second point: ")) ) (entmakex (append (vl-remove-if '(lambda (x) (= 330 (car x))) el) (list (cons 10 p2)))) ) (princ) )
    2 points
  4. This is what i use to create a text over blocks ;;----------------------------------------------------------------------------;; ;; LABLE BLOCKS BY NAME MIDPOINT OF BOUNDINB BOX (defun C:BLKNAME (/ SS e Name LL UR MPT) (if (setq SS (ssget '((0 . "INSERT")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq Name (cdr (assoc 2 (entget e)))) (vla-getboundingbox (vlax-ename->vla-object e) 'minpt 'maxpt) (setq LL (vlax-safearray->list minpt) UR (vlax-safearray->list maxpt) MPT (mapcar '/ (mapcar '+ LL UR) '(2 2 2)) ) (entmake (list '(0 . "TEXT") '(8 . "0") (cons 10 MPT) (cons 11 MPT) ;needed for text that isn't left justify (cons 40 (getvar 'Dimtxt)) ;use current dim text size or hard code a height (cons 1 name) '(72 . 4) ;Text justification Middle Center ) ) ) (prompt "\nNo Blocks Selected") ) (princ) )
    1 point
  5. 1 point
  6. for got to comment on this but always use "_non" in front of points in command. (command "_.Pline" "_non" pt3 "_non" pt2 "_non" pt1 "") just know if any of those points where close to geometry even if osnaps are off (f3 toggle) it could still snap to things that where close. the "_non" tells the command pline snap to this point only nothing else
    1 point
  7. Welcome. us cs rus complete shouldn't be broken out but run inside the same lisp. this allows you to control/define local variables. when you don't define local variables it makes them global variables and if your are running multiple lisp that could be a potential to get unexpected results. I always try to avoid using (command when i can it has the highest potential to mess up. vs setting a variable. plus even tho you have cmdecho set to 0 their could be output to the command line anyway. these do the same thing. (command "layer" "set" "dims" "") (setvar 'clayer "dims") Added a neat little trick with mapcar to set or get multiple variables at once. (defun c:crmrk ( / *error* lst val cnr pt1 pt2 pt3) (setq Drawing (vla-get-activedocument (vlax-get-acad-object))) ;needed for start and end marks (defun *error* (msg) (mapcar 'setvar lst val) (vla-endundomark Drawing) (princ msg) ) (setq lst (list 'CMDECHO 'OSMODE 'PICKBOX 'CLAYER) val (mapcar 'getvar lst) ;saves current var of above list ) (vla-startundomark Drawing) ;wont output to command line or affect selections (mapcar 'setvar lst '(0 5 0 "dims")) ;sets the list of system variables ;cmdecho = 0 ;osmode = 5 ;replaces (command "_.-osnap" "end,center") ;picking cursor ;pickbox = 0 ;i usually keep it at 5 ;clayer = "dims" ;replaces (command "layer" "set" "dims" "") (setq cnr (getpoint "\nPick Corner: ")) (setq pt1 (polar cnr pi 2.0)) (setq pt2 (polar pt1 4.71239 1.5)) (setq pt3 (polar pt2 0 1.5)) (command "_.Pline" "_non" pt3 "_non" pt2 "_non" pt1 "") (command "_.Rotate" (entlast) "" cnr "ref" 225 pause) (vla-endundomark Drawing) (mapcar 'setvar lst val) ;returns system variables back to what they where before command (princ) ) The error handling is if you exit out of this lisp or it errors (you don't pick point cnr) it will set the system variables back to what they where before the command was run.
    1 point
  8. Try this: (if (setq e (dictsearch (namedobjdict) "ACAD_DATALINK")) (vla-delete (vlax-ename->vla-object (cdr (assoc -1 e)))) )
    1 point
×
×
  • Create New...