Jump to content

All Activity

This stream auto-updates

  1. Today
  2. Thanks, I'll try it. There is another option, but it does not work for all formats. ;; A3x3 (420x891) ((and (<= SideS 425) (<= SideL 896)) (vla-put-CanonicalMediaName Layout "UserDefinedMetric (891.00 x 420.00мм)"))
  3. @Nikon The "COND" statement will stop as soon as it meets the criteria for the square area range, so if something else meets the that area range before getting to your desired state, it will never get there. You will have to do a different comparison that is unique to the criteria. Maybe to change the criteria for the conditional statement to comparing the Length and width specifically, rather than with the area, or a combination of the area and the width, or something else, like a unique layer or color. Maybe something like this instead (you can alter to suit the fudge factor for the viewport height and width): (cond ((and (> 290.0 ViewPortHeight 300.0) (> 600.0 ViewPortWidth 650.0));; Compare the width and height directly! (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 630.00мм)") ) ((and (> 290.0 ViewPortHeight 300.0) (> 835.0 ViewPortWidth 845.0)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.0мм)") ) ... ;; Repeat for all desired sizes ) NOTE: You would also have to do both a landscape version and a Portrait version if you need both. Perhaps a bit more sophisticated comparison: (cond ((or (and (> 290.0 ViewPortHeight 300.0) (> 600.0 ViewPortWidth 650.0)) (and (> 290.0 ViewPortWidth 300.0) (> 600.0 ViewPortHeight 650.0)) ) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 630.00мм)") ) ((or (and (> 290.0 ViewPortHeight 300.0) (> 835.0 ViewPortWidth 845.0)) (and (> 290.0 ViewPortWidth 300.0) (> 835.0 ViewPortHeight 845.0)) ) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.0мм)") ) ... ; Repeat for all desired sizes (T (vla-put-ConfigName Layout "None")) ; Default to No plotter for non-standard sizes ) NOTE: I can't test this directly without a "real world" sample drawing to compare, along with your pc3 file, so I'm trying to give you the knowledge to do it yourself, which is preferrable anyway.
  4. Artem

    Segments of polylines

    Hi, you did a fantastic job. The few options is realy good, and handy to use. I have only 1 question left - can that tool not create a clone of polyline, but edit current? To transform polyline with all parameters and e.t.c. If you will be doing that, its nessesary obly for lw_orth_2 (2nd version) it works better for cases i have faced. Does it even possible to transform line like it doing it not with clone? Thanks you very much already!!!
  5. (setq ss (ssget "X" '((-4 . "<OR") (62 . 40) (62 . 33) (62 . 25) (62 . 179) (-4 . "OR>")))) https://www.lee-mac.com/ssget.html#logical
  6. just FYI for @ScottMC That while loop is running 1000's times a sec and is intended to only pause waiting for user input to be completed. Can be simplified to this. (while (> (getvar 'CMDACTIVE) 0) (Command "\\") ) Another option would be to use grread and grdraw to show a visualization of a circle but not actually add it to the drawing. Tho I found out it can only draws lines and you need to trick it to make segmented circles. will post something later tonight.
  7. I use polar tracking and osnaps in AutoCAD. Looks like nanoCAD has similar... Precision tools. Object Snap tracking mode. Download CAD software
  8. take a look at this : https://help.autodesk.com/view/ACD/2025/ENU/?guid=GUID-DD9B3216-A533-4D47-95D8-7585F738FD75
  9. Yesterday
  10. Thanks PK for finding that. Something I've never found or got direct connection to error but now will have that as an understood rule. Will certainly look for that in my troubleshooting.
  11. sinergy2020

    How to copy an object to a specified distance

    Not sure I totally understand this last .....is there a listing of osmodes somewhere? When I type osmode I get (by default) 549 ... what does it mean??? And, can I write lisp code in nanocad?
  12. Non-standard formats are often required for drawings.
  13. I don't understand why your using non standard size sheets ? A2 can be shown as 4 A4's same with 3 to be used but 4th blank. A A4x2 is a A3, the internal linework would be on a non plot layer. You could have 4 viewports shown.
  14. Like @CyberAngel if you set your osnap to what you want then type "Osmode" a number will appear that is current osnaps settings. Ok part two in say chx you can add this code. Note 1 is End. 0 is off. Normal drafting for me is 47. Try it (setvar 'osmode 47) then type osnap. For say a circle use 4. put at start (setq oldsnap (getvar 'osmode)) (setvar 'osmode 1) .... code put at end (setvar 'osmode oldsnap)
  15. The layout is created correctly for this non-standard format. ((and (> Square 177755) (< Square 196466)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 630.00мм)")) For this non-standard format (А4х4), the layout is set to A2_(594.00_x_420.00_MM), since the squares are the same (249480 и 249777), and therefore, the format that was previously written in the code is set. ((and (> Square 237006) (< Square 261954)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "ISO_full_bleed_A2_(594.00_x_420.00_MM)")) ; А2 594.00x420.00=249480 ((and (> Square 237288) (< Square 262266)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.00мм)")) ; А4х4 297.00x841.00=249777 How can this be fixed? If the lines in are arranged like this ((and (> Square 237006) (< Square 261954)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "ISO_full_bleed_A2_(594.00_x_420.00_MM)")) ; А2 594.00x420.00=249480 ((and (> Square 237288) (< Square 262266)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.00мм)")) ; А4х4 297.00x841.00=249777 If the lines in are arranged like this ((and (> Square 237288) (< Square 262266)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "UserDefinedMetric (297.00 x 841.00мм)")) ; А4х4 297.00x841.00=249777 ((and (> Square 237006) (< Square 261954)) (vla-put-ConfigName Layout "DWG To PDF.pc3") (vla-put-CanonicalMediaName Layout "ISO_full_bleed_A2_(594.00_x_420.00_MM)")) ; А2 594.00x420.00=249480
  16. If you look at this snippet of code it is all the values required, insert correct title block and make a viewport. This is for one viewport, multiple title blocks. (cond ((= ntitle "A0_Landscape") (setq ht 780.0 wid 1160.0 xpt 878.0 xwid 62.0 yht 32.0)) ((= ntitle "A1_Landscape") (setq Ht 541.0 wid 831.0 xpt 542.0 xwid 62.0 yht 32.0)) ((= ntitle "A1_Portrait") (setq Ht 774.0 wid 571.0 xpt 229.0 xwid 62.0 yht 32.0)) ((= ntitle "A2_Landscape") (setq ht 367.0 wid 584.0 xpt 295.5 xwid 62.0 yht 32.0)) ((= ntitle "A2_Portrait") (setq ht 554.0 wid 410.0 xpt 209.5 xwid 41.0 yht 23.0)) ((= ntitle "A3_Landscape") (setq ht 247.0 wid 400.0 xpt 200.0 xwid 41.0 yht 23.0)) ) So for multiple viewport the cond would use a "list" of values, title block then the viewport say lower left X,Y then upper right X,Y, repeat for how many viewports required. You could pick correct title block from a dcl radio button you can have around 20 in vertical dcl. If I am understanding correct post a true title block with say 3 viewports and will post some sample code,
  17. sinergy2020

    How to copy an object to a specified distance

    Thanks again @CyberAngel I just realized that I didn't check the boxes of the different snap settings
  18. @ScottMC I don't recommend you put the OSMODE change in the CMDACTIVE loop. Here is how I would do it; tested this and it works perfectly. (defun c:C2 (/ cr el *error* fp oe os p p2) (defun *error* (msg) (if oe (setvar "cmdecho" oe)) (if os (setvar "osmode" os)) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ (strcat "\n" msg)) ) (vla-startundomark (vla-get-activedocument (vlax-get-acad-object))) (setq oe (getvar "cmdecho") os (getvar "osmode") ) (setvar "cmdecho" 0) (while (and (setvar 'osmode (boole 7 os 512)) (setq fp (getpoint "\nSpecify 1st Point of 2P.Circle: ")) ) (command "._Circle" "_2P" "_non" fp "_per");; Add "PER" to overide OSNAP here. (princ "\nSecond Point: ") (while (= (logand (getvar "cmdactive") 1) 1) (command pause) ) (setvar "osmode" os) (setq el (entget (entlast)) p (trans (cdr (assoc 10 el)) (cdr (assoc 210 el)) 1) p2 (getvar "lastpoint") cr (getvar "circlerad") ) (entdel (entlast)); Delete the Circle (princ (strcat "\n Coordinates: " (setq C2:pp ;; Global Variable "C2:pp" (strcat (rtos (car p) 2 4) "," (rtos (cadr p) 2 4) "," (rtos (caddr p) 2 4) ) ) "\n Diameter: " (rtos (* cr 2) 2 4) " | Radius: " (rtos cr 2 4) "\n" ) ) (entmakex (list (cons 0 "POINT") (cons 10 p))) (entmakex (list (cons 0 "POINT") (cons 10 p2))) (entmakex (list (cons 0 "CIRCLE") (assoc 10 el) (assoc 8 el) (assoc 40 el))) ; Recreate the Circle ) (setvar "cmdecho" oe) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (princ) ) If you don't want PERP to be the only snap available, then try your method, but before the CMDACTIVE loop: (command ".circle" "2p" 1st) (setvar 'cmdecho 1) (setvar 'osmode (boole 7 (getvar 'osmode) 128)) ;; added 'perp (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\") )
  19. CyberAngel

    How to copy an object to a specified distance

    According to the NanoCAD web site, there is a snap option (OSNAP) that works like AutoCAD's. The endpoint snap ought to pick up the corners of a rectangle, unless there's something weird about NanoCAD's rectangle. Assuming you can snap onto the bottom right corner of the existing rectangle, you should be able to give a displacement from there to the bottom left corner of the new rectangle. That seems to be what you want. The whole point of snap mode is to give you an exact location based on an object, not on your closest pick point. Is it possible that you have a grid option enabled at the same time? That would explain why you can't always snap to an object, if there are grid intersections all around it. According to NanoCAD again, there is a "Snap and Grid" tab in the Drafting Settings dialog. Disable the grid snap and see what happens.
  20. Hi everyone i need some help for autolisp I have many elements that have specific color (set to color 40,33,25,179... (not set to bylayer)) in my drawing so i wish to find all elements that have above specific color, and change property of element to bylayer to see element with bylayer color I found some Lisp but it changed all element's color to bylayer in drawing. it changed elements that i didn't want to changed to bylayer, so i asking for help here is there any lisp can change element's color to bylayer ? i wish lisp work only for elements that color set to color 40,33,25,179
  21. ReMark

    Penn Foster Structural Drafting

    I'm assuming you created what is shown in the image above. You need to show the drain above the footing, the steel reinforcing rods, or rebar, as they are referred to in the concrete footings and columns, the baseplate at the foot of the columns, the columns themselves, etc., etc., etc. There are other threads about this project, in this forum, that contain word descriptions along with images that should prove useful to you. I suggest you research them as duplicating all that information here would be counterproductive.
  22. Thank you, is it possible to write this in the code so that the layout parameters are obtained automatically. I didn't understand this line: ("A3" "0,20" "140,190" "140,20" ""280,190"
  23. (defun rh:dxf (code lst) (cdr (assoc code lst))) (defun c:aa ( / cmde ent e_typ e_lst area vtx x_lst y_lst z_lst x_pt y_pt z_pt c_lst v_lst ss sum sz) (cond ( (/= 0 (getvar 'cmdecho)) (setq cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) ) ) (while (setq ss (ssget "_+.:E:S" '((0 . "POLYLINE,LWPOLYLINE") (-4 . "<OR") (70 . 1) (70 . 3) (70 . 5) (-4 . "OR>") ) )) (setq ent (ssname ss 0) e_typ (rh:dxf 0 (setq e_lst (entget ent))) area (getpropertyvalue ent "area") v_lst nil ) (cond ( (= e_typ "POLYLINE") (setq ent (entnext ent) vtx (rh:dxf 10 (entget ent)) ) (if (< (length vtx) 3) (setq vtx (reverse (cons 0.0 (reverse vtx))))) (while (/= "SEQEND" (cdr (assoc 0 (entget ent)))) (setq v_lst (cons vtx v_lst) ent (entnext ent) vtx (rh:dxf 10 (entget ent)) ) (if (< (length vtx) 3) (setq vtx (reverse (cons 0.0 (reverse vtx))))) ) (setq x_pt (/ (apply '+ (mapcar '(lambda (x) (car x)) v_lst)) (length v_lst)) y_pt (/ (apply '+ (mapcar '(lambda (x) (cadr x)) v_lst)) (length v_lst)) ) (if (= (setq sum (apply '+ (mapcar '(lambda (x) (caddr x)) v_lst))) 0.0) (setq z_pt 0.0) (setq z_pt (/ sum (length v_lst))) ) ) ( (= e_typ "LWPOLYLINE") (setq z_pt (rh:dxf 38 e_lst)) (foreach pr e_lst (if (= (car pr) 10) (setq v_lst (cons (cdr pr) v_lst))) ) (setq x_pt (/ (apply '+ (mapcar '(lambda (x) (car x)) v_lst)) (length v_lst)) y_pt (/ (apply '+ (mapcar '(lambda (x) (cadr x)) v_lst)) (length v_lst)) ) ) ) (setq c_lst (list x_pt y_pt z_pt)) (if(not sz) (progn (vla-getboundingbox (vlax-ename->vla-object ent) 'MinPT 'MaxPT) (setq p1 (vlax-safearray->list MinPT) p2 (vlax-safearray->list MaxPT)) (setvar 'textsize (* 0.05 (distance p1 p2))) (setq sz t) ) ) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 c_lst) (cons 40 (getvar 'textsize) ) (cons 71 5) (cons 72 5) (cons 1 (strcat (rtos (/ area 1000000.0) 2 2) "m\U+00B2")) ) ) ) (if cmde (setvar 'cmdecho cmde)) )
  24. (defun rh:dxf (code lst) (cdr (assoc code lst))) (defun c:aa ( / cmde ent e_typ e_lst area vtx x_lst y_lst z_lst x_pt y_pt z_pt c_lst v_lst ss sum) (cond ( (/= 0 (getvar 'cmdecho)) (setq cmde (getvar 'cmdecho)) (setvar 'cmdecho 0) ) ) (while (setq ss (ssget "_+.:E:S" '((0 . "POLYLINE,LWPOLYLINE") (-4 . "<OR") (70 . 1) (70 . 3) (70 . 5) (-4 . "OR>") ) )) (setq ent (ssname ss 0) e_typ (rh:dxf 0 (setq e_lst (entget ent))) area (getpropertyvalue ent "area") v_lst nil ) (cond ( (= e_typ "POLYLINE") (setq ent (entnext ent) vtx (rh:dxf 10 (entget ent)) ) (if (< (length vtx) 3) (setq vtx (reverse (cons 0.0 (reverse vtx))))) (while (/= "SEQEND" (cdr (assoc 0 (entget ent)))) (setq v_lst (cons vtx v_lst) ent (entnext ent) vtx (rh:dxf 10 (entget ent)) ) (if (< (length vtx) 3) (setq vtx (reverse (cons 0.0 (reverse vtx))))) ) (setq x_pt (/ (apply '+ (mapcar '(lambda (x) (car x)) v_lst)) (length v_lst)) y_pt (/ (apply '+ (mapcar '(lambda (x) (cadr x)) v_lst)) (length v_lst)) ) (if (= (setq sum (apply '+ (mapcar '(lambda (x) (caddr x)) v_lst))) 0.0) (setq z_pt 0.0) (setq z_pt (/ sum (length v_lst))) ) ) ( (= e_typ "LWPOLYLINE") (setq z_pt (rh:dxf 38 e_lst)) (foreach pr e_lst (if (= (car pr) 10) (setq v_lst (cons (cdr pr) v_lst))) ) (setq x_pt (/ (apply '+ (mapcar '(lambda (x) (car x)) v_lst)) (length v_lst)) y_pt (/ (apply '+ (mapcar '(lambda (x) (cadr x)) v_lst)) (length v_lst)) ) ) ) (setq c_lst (list x_pt y_pt z_pt)) (vla-getboundingbox (vlax-ename->vla-object ent) 'MinPT 'MaxPT) (setq p1 (vlax-safearray->list MinPT) p2 (vlax-safearray->list MaxPT)) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 c_lst) (cons 40 (* 0.02 (distance p1 p2)) );(getvar 'textsize)) (cons 71 5) (cons 72 5) (cons 1 (strcat (rtos (/ area 1000000.0) 2 2) "m\U+00B2")) ) ) ) (if cmde (setvar 'cmdecho cmde)) )
  25. totally guessing but seems to crash on multi seq. here's the mods u suggested added. Guessing the: (while (= (logand (getvar "cmdactive") 1) 1) ;; <--- might be crash source didn't do a vlide source method yet. So many of my copy/erase/paste to be replaced! Thanks PK. (defun c:c2 ( / *error* el p oldsnap 1st) ;just 2 point.. //wasCIRCLE TANGENT RE: 19SEPT17 (princ "\n 2.Point Circle (M) <'CT for.tan !pp> ") (setq oldsnap (getvar 'osmode)) (setvar 'osmode (boole 7 (getvar 'osmode) 512)) ;; added 'nea for 1st point (defun *error* ( msg ) (setvar 'cmdecho 0) ;; 5.28.24 (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) (setvar 'osmode oldsnap) (if msg (prompt (strcat "\n" msg))) (setvar 'cmdecho 1) (princ) ) (initget 103) (setvar 'cmdecho 0) (while T ;; 'M' loop.. (setq 1st (getpoint "\n Specify 1st Point of 2P.Circle: ")) ;; get 1st edge of '2p.cir (command ".circle" "2p" 1st) (setvar 'cmdecho 1) (while (= 1 (logand 1 (getvar 'cmdactive))) (setvar 'osmode (boole 7 (getvar 'osmode) 128)) ;; added 'perp (command "\\") ) (setq p2 (getvar 'lastpoint)) ;; posted \/ y,n? (setq el (entget (entlast))) ;; <-- removed replaced copy/erase (setq p (trans (cdr (assoc 10 el)) (cdr (assoc 210 el)) 1)) ;; 210 for 'z' direction (entdel (entlast)); Delete the Circle for last ent selection.. (setvar 'osmode oldsnap) (setvar 'cmdecho 0) (princ "\n") (princ (setq pp ;; make/prints coords & paste usable (strcat (rtos (car p) 2 4) "," ;; 'p' -- vertex from pgm /\ getpoint,... (rtos (cadr p) 2 4) "," (rtos (caddr p) 2 4) ) ) ) (princ (strcat " | Ø: " (rtos (* (getvar 'circlerad) 2) 2 4)" | R: " (rtos (getvar 'circlerad) 2 4))) (entmakex (list (cons 0 "POINT") (cons 10 p))) ;; clean point (entmakex (list (cons 0 "POINT") (cons 10 p2))) ;; clean point (entmakex (list (cons 0 "CIRCLE") (assoc 10 el) (assoc 8 el) (assoc 40 el))) ; Recreate the Circle (setenv "pp" pp) ;; sys saved, restored at restart ) ;; end of while (setvar 'cmdecho 1) (*error* nil) ;; restore saved vars (princ) )
  26. Last week
  27. Are you saying you want say a A3 sheet 420x297 but with 3 viewports, that can be done. To have a oversize sheet does not make sense to me. You just set up the sheet details and the location of each viewport, not hard to do. ("A3" "0,20" "140,190" "140,20" ""280,190" and so on)
  28. Hi Steven, spot on! The LISP definitely flags raw geometry changes, not design intent. I actually use it as a "first pass" safety net. It's much faster to let the script cloud everything that moved and simply delete the few "false positives" (like lines stretched for spacing) than to manually hunt for actual design changes. For the overlapping issue: the clouds are standard polylines on a dedicated layer. You can easily grip-stretch them out of the way, or use DFCT beforehand to increase the padding so they draw looser. It doesn't replace a drafter's eye, but it definitely handles the heavy lifting of finding the changes first! Thanks for checking it out.
  1. Load more activity
×
×
  • Create New...