Jump to content

All Activity

This stream auto-updates

  1. Today
  2. lemmanapat

    Combining 2 Different LISP into One Code

    Thanks for suggestions!, may you please elaborate more? i have little to no experience in LISP and asking for your patience to explain briefly so i can understand the codes. thank you so much!
  3. Jonathan Handojo

    save getxxx previous value

    You are almost correct. In your rectification above, the global variable will be set to nil if the user presses Enter without giving a distance. The purpose of the cond function is to justify the default value that was previously stored. In my code snippet, the cond function will put in whatever value the user inputs (if the user actually does input something in). Otherwise, getdist then returns nil, and the cond function proceeds into the second line and inserts the default variable. In your snippet, you managed to get your message prompt right. However, remember that, just because the prompt simply alerts the user the default value using <> doesn't mean that getdist acually returns that value. You still need to use if conditions to account for this.
  4. Hello ELF-153, welcome in the forum! You could edit the code yourself using Notepad. After the line (setq d (getdist.....) insert this: (setq d (* 0.5 d)) After you enter the distance, that will cut it in half before it use it. Good luck!
  5. I am not sure if my question is related, but I am trying to figure out how to do a radial dimension inside small arc without radial extension (past center of arc).
  6. I have moved your thread to the Architecture & ADT Forum.
  7. There is a dwg file attached to my first post with 4 proxy blocks. I will attach it again. I need to label the LXY and TAUPUR. Text size and style are not important, could be anything, as well the layer is not important. What I am looking for is just some of the information from inside the block, to avoid making the notes manually for now. Everything else is just extra detail. Thank you 1.dwg
  8. Hello! I've recently begun a new job and the system they have is Autocad Architecture 2018. My question relates to using bay or bow windows inserted with the tools palette. Whenever I insert these they seem to have a boundary in a thicker line that I can't seem to turn off or hide. I have attached a screengrab. the red arrows indicate the line in question. Ideally, I want to turn off / hide the line spanning between the walls (larger red arrow pointing upwards). When I insert casement windows they don't seem to have this thicker line on them. I have looked on the forum for hours but can't seem to find this question. Any help is appreciated!
  9. Hello, I just found this thread and lisp (DoubleOffsetV1-1) and installed it. I'm searching for one where my source line would be centre of the input distance typed. For example, when prompted I type 18" and then it would offset 9" on either side, so the the total is 18". Is there a simple way to edit this one, or another known lisp out there?
  10. and for completion, this uses VLA- functions, you were half way there earlier - no attsync required (defun c:MoveBlocks ( / target-point block-name) (setq target-point '(300.0 5.25 0.0)) ;;Point to move to (setq block-name "RegionserviceUTR") ;;Block Name to move (MoveBlock target-point block-name) ) (defun MoveBlock (target-point block-name / BlockSS acount) (setq BlockSS (ssget "_X" (list '(0 . "INSERT")(cons 2 block-name)))) (setq acount 0) (while (< acount (sslength BlockSS)) (setq Pt1 (vlax-3d-point (cdr (assoc 10 (entget (ssname BlockSS acount) )))) ) (setq Pt2 (vlax-3d-point target-point) ) (vla-move (vlax-ename->vla-object (ssname BlockSS acount)) Pt1 Pt2) (setq acount (+ acount 1)) ) ; end while (princ) )
  11. Oh that worked perfect, many thanks!
  12. Looking at the block, probably AttSync will work. Sometimes this won't work if you have changed the attributes in a block in the Enhanced Attribute Editor, AttSync will reset them to the default, so try below. For example, Sometimes with title blocks if the freetexts - drawing title or description can extend out of the area assigned and you change the width factor perhaps - attsync will reset that (as a example) (defun c:MoveBlocks ( / target-point block-name) (setq target-point '(300.0 5.25 0.0)) ;;Point to move to (setq block-name "RegionserviceUTR") ;;Block Name to move (MoveBlock target-point block-name) ) (defun MoveBlock (target-point block-name / BlockSS acount) (setq BlockSS (ssget "_X" (list '(0 . "INSERT")(cons 2 block-name)))) (setq acount 0) (while (< acount (sslength BlockSS)) (entmod (subst (cons 10 target-point) (assoc 10 (entget (ssname BlockSS acount))) (entget (ssname BlockSS acount)) )) (setq acount (+ acount 1)) ) ; end while (command "attsync" "N" block-name) )
  13. Thank you! You will find the block in layouts Drawing2.dwg
  14. Post a sample drawing, it should be reasonably easy but could be a couple of things - so post a sample if you can with the example block in it
  15. Yes exactly! That creates a diffrent problem... Im not sure how to explain it but all instances of the block moves. But inside the block there are other textnotes that (also are the attributes of the block) that wont move with the rest. The text that is marked wont move and the text that is not marked moves. All i really want is to cahnge Position X of this blockdefinition
  16. It looks like you are trying to move all the blocks with the block definition name RegionserviceUTR to a single point? I guess this is only a part of what you are trying to do. Try this way (defun c:MoveBlocks ( / target-point block-name) (setq target-point '(300.0 5.25 0.0)) ;;Point to move to (setq block-name "RegionserviceUTR") ;;Block Name to move (MoveBlock target-point block-name) ;;Run the nmove bock LISP with the above name and point (princ "\nBlocks Moved Successfully") ;;Report success (princ) ;;Exit quietly ) (defun MoveBlock (target-point block-name / BlockSS acount) (setq BlockSS (ssget "_X" (list '(0 . "INSERT")(cons 2 block-name)))) ;;Select all blocks with the specified name ;;Can alter the ssget filter as required - resources online - doesn't 'need' the '0' if you are specifying the '2' in nearly all cases. (setq acount 0) ;; Just a counter (while (< acount (sslength BlockSS)) ;; Loop through the selected blocks (entmod (subst (cons 10 target-point) ;; Substitute insert point: New insert point (assoc 10 (entget (ssname BlockSS acount))) ;; Existing insert point (entget(ssname BlockSS acount)) ;; Entity to update )) (setq acount (+ acount 1)) ;; Count a little bit more ) ; end while ;; End Loop )
  17. That´s unfortunate. I utilized the block definition to modify attributes, which was convenient when I needed to alter every instance of the block. But... I also need to move each block.
  18. 1. you cannot move a Blockdefinitionn only a BlockReference. The method your using gives you the Blockdefinition. 2. you need 3 Arguments for the vla-move method: (vla-Move Object<vla-object> Point1<variant:xyz> Point2<variant:xyz>) 3. your pointlist has to be in variant format so use vlax-3d-point to convert your point list to a variant
  19. Hi, I´m trying to move some blocks but i get ActiveX error. ActiveX Server returned the error: unknown name: Move Here is the code, but feels like i need to reinstall Cad? (defun c:MoveBlocks () (setq target-point '(300.0 5.25 0.0)) (setq block-name "RegionserviceUTR") (vl-load-com) (defun move-blocks (block-name target-point) (vlax-for block (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (if (equal block-name (vla-get-Name block)) (vla-move block target-point) ) ) ) (move-blocks block-name target-point) (princ "Blocks moved successfully.") (princ) )
  20. Hello All, could someone make me a simple lisp routine that puts a multileader with 2 arrows each arrow needs to point to the start and endpoint of a polyline and prompt me to enter the label for the multileader plus the label needs to run 3 meters polar to the polyline. i have attached an example in which i have manually put n the multileader and rotate them so their are a bit parallel to the polyline. WTE-001-CR99.dwg
  21. i once needed something similar, i found a function somewhere online that does that and modified it somewhat to my needs. Its still somewhat clumpy but maybe it helps.. (defun c:divarea (/ *error* osmode cmdecho blipmode correctent-p ready fixpt parpt answer ename divider area) (defun *error* (msg) (if osmode (setvar "osmode" osmode)) (if cmdecho (setvar "cmdecho" cmdecho)) (if blipmode (setvar "blipmode" blipmode)) (princ (strcat "\nError: " msg)) (princ) ) (defun correctent-p (ent /) (if ent (and (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") (= (cdr (assoc 70 (entget ent))) 1) ) nil ) );defun (defun ready () (setvar "osmode" osmode) (setvar "cmdecho" cmdecho) (setvar "blipmode" blipmode) (princ (strcat "\nFull Area : " (rtos area))) (princ (strcat "\nNew Area : " (rtos newarea))) (princ) );defun (defun initiate-parpt (newarea i / parpt getcenter divisionline boundarypoint oldline ptb temp newboundary pt1) (defun parpt (tem line pts / p1 p2 precision deln pts par linedata) (setvar "osmode" osmode) (setq precision (/ (vla-get-length (vlax-ename->vla-object line)) 10)) (setvar "osmode" 0) (command "_line" p1 p2 "") (setq deln (entlast)) ;put line to delete later (if (not ptb) (setq ptb (getpoint "\nPick any point into the REST of the piece, FAR from division line: "))) (setvar "blipmode" 0) (princ "\nPlease wait...") (command "_boundary" pts "") (setq newboundary (entlast)) (setq par (vla-get-area (vlax-ename->vla-object newboundary))) ;par = area created by boundary (while (> (abs (- par tem)) 0.00001) (if (< par tem) (progn (while (< par tem) (entdel newboundary) ;delete boundary (command "_offset" precision deln ptb "") (entdel deln) (setq deln (entlast)) (command "_boundary" pts "") (setq newboundary (entlast)) (setq par (vla-get-area (vlax-ename->vla-object newboundary))) ) ) (progn (while (> par tem) (entdel newboundary) (command "_offset" precision deln pts "") (entdel deln) (setq deln (entlast)) (command "_boundary" pts "") (setq newboundary (entlast)) (setq par (vla-get-area (vlax-ename->vla-object newboundary))) ) ) ) (setq linedata (entget deln)) (entdel deln) (setq precision (/ precision 1.5)) (princ precision) ) (command "_change" newboundary "" "_p" "_c" "_green" "") linedata );defun (defun getcenter (line1 line2 / p1 p2) (setq p1 (cdr (assoc 10 (entget line1)))) (setq p2 (cdr (assoc 11 (entget line2)))) (list (/ (+ (car p1) (car p2)) 2) ; x-coordinate of the center point (/ (+ (cadr p1) (cadr p2)) 2) ; y-coordinate of the center point ) );defun (command "_line" (setq pt1 (getpoint "\nPick one point of division line (far from lwpoly) : ")) (getpoint pt1 "\nPick other point of division line (far from lwpoly) : ") "" ) (setq divisionline (entlast)) (setq boundarypoint (getpoint "\nPick any point into FIRST piece, FAR from division line: ")) (setq temp (parpt newarea divisionline boundarypoint)) (while (> i 2) (entmake temp) (setq oldline (entlast)) (command "_offset" (/ (vla-get-length (vlax-ename->vla-object oldline)) 200) oldline ptb "") (setq divisionline (entlast)) (setq boundarypoint (getcenter oldline divisionline)) (entdel oldline) (setq temp (parpt newarea divisionline boundarypoint)) (setq i (1- i)) ) (command "_boundary" ptb "") (setq newboundary (entlast)) (command "_change" newboundary "" "_p" "_c" "_green" "") );defun (setq osmode (getvar "osmode") cmdecho (getvar "cmdecho") blipmode (getvar "blipmode") ) (setvar "osmode" 0) (setvar "cmdecho" 0) (while (not (correctent-p ename)) (setq ename (car (entsel "\nSelect closed LWPOLY to divide: "))) ) (setq area (vla-get-area (vlax-ename->vla-object ename))) (initget "Divide Cut") (setq answer (cond ((getkword "\nDIVIDE by number or CUT a part ? [Divide/Cut] <Divide>: ")) ("Divide"))) (if (= answer "Divide") (progn (setq divider (cond ((getreal "\nEnter number to divide the whole part by <2>: ")) (2))) (setq newarea (/ area divider)) ) (setq newarea (getreal "\nArea to cut : ")) ) (initiate-parpt newarea divider) (ready) )
  22. Tsuky

    export polyline length to excel

    This ? (vl-load-com) (defun WriteExcel (data / xlApp wBook cells i j) (setq xlApp (vlax-create-object "Excel.Application") wBook (vlax-invoke-method (vlax-get-property xlapp 'WorkBooks) 'Add) cells (vlax-get-property xlApp 'Cells) i 0 ) (foreach row data (setq i (1+ i) j 0) (foreach val row (setq j (1+ j) cell (vlax-variant-value (vlax-get-property cells 'Item i j)) ) (vlax-put-property cell 'Value2 val) ) ) (vlax-invoke-method (vlax-get-property (vlax-get-property xlApp 'ActiveSheet) 'Columns ) 'AutoFit ) (vlax-put-Property xlApp 'Visible :vlax-true) ) (defun c:length2excel ( / ss n ent e_col e_length data) (setq ss (ssget "_X" '((0 . "LWPOLYLINE")))) (cond (ss (repeat (setq n (sslength ss)) (setq ent (ssname ss (setq n (1- n))) e_col (if (assoc 62 (entget ent)) (cdr (assoc 62 (entget ent))) (cdr (assoc 62 (entget (tblobjname "LAYER" (cdr (assoc 8 (entget ent))))))) ) e_length (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) data (cons (list e_length e_col) data) ) ) (if data (WriteExcel (cons (list "LENGTH" "Color") (reverse (vl-sort data '(lambda (e1 e2) (< (cadr e1) (cadr e2))))) ) ) ) ) ) (prin1) )
  23. Here is a Lisp. It can add 1 (or other number) to an integer attribute of many blocks, at once. (defun c:pp() (setq blockName (getstring T "Block name: ") attrName (strcase (getstring T "Attribute: ")) plus (getint "value to add: ")) (setq ss (ssget (list '(0 . "INSERT")(cons 2 blockName)'(66 . 1)))) (repeat (setq i (sslength ss)) (setq en (ssname ss (setq i (1- i)))) (while (and (/= (cdr (assoc 0 (setq el (entget en)))) "SEQEND") (/= (cdr (assoc 2 el)) attrName)) (setq en (entnext en))) (setq el (subst (cons 1 (itoa (+ plus (atoi (cdr (setq ass1 (assoc 1 el))))))) ass1 el) el (entmod el)) ) (setq ss nil) )
  24. Dear Sir, I want explode multileaders as i want to put my leaders in Leader layer & Mtext in Text layer. But the problem i am facing is while i am exploding the Multi leaders which turn into separate entities . But actually i want it to be a normal leader & mtext. can anyone please help me on this .
  25. I'm using a 2d viewport. I want to set the viewport center in model space for coordinate data. I know this can be done by entering the viewport, using zoom, and exiting the viewport.. I'm looking for a method to center the viewport view in model space without going into the viewport. The xdata "ACAD" viewport editing method seems the way to go for this.
  1. Load more activity
×
×
  • Create New...