TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: vincent.r on August 30, 2019, 11:53:58 AM

Title: block insertion point problem
Post by: vincent.r on August 30, 2019, 11:53:58 AM
Hi,
Created a routine to insert blocks as per excel database. It works fine for few blocks. but some blocks are not inserted on its position. VL console shows perfect coordinates. Tried purge redefining block that is "HCR21=C:/Users/shrinand_bhedasgaonk/Desktop/stuff/IO DRAWINGS/HCR21.dwg" .
code is lengthy but simple.


   (setq xflst (car xfi))
     (setq xlstlength (length xflst))
       (setq tocheck (nth 13 xflst));3
     (setq lno (nth 2 xflst))
     (if (= lno "1") (setq ax 58.7470 ay 620.7206))
     (if (= lno "2") (setq ax 58.7470 ay 600.7206))
     (if (= lno "3") (setq ax 58.7470 ay 580.7206));var set
     (if (= lno "4") (setq ax 58.7470 ay 560.7206))
     (if (= lno "5") (setq ax 58.7470 ay 540.7206))
     (if (= lno "6") (setq ax 58.7470 ay 520.7206))
     (if (= lno "7") (setq ax 58.7470 ay 500.7206))
     (if (= lno "8") (setq ax 58.7470 ay 480.7206))
(if (and (/= xtocheck nil)
    (/= xlno nil)
    )
           (progn
           (if (= xtocheck "Field") (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/Field_wire_connection.dwg" (strcat (rtos (- ax 2.5)) "," (rtos ay)) "1" "1" "0"))
           (if (= xtocheck "Panel") (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/Panel_wire_connection.dwg" (strcat (rtos (- ax 2.5)) "," (rtos ay)) "1" "1" "0"))
           (command "explode" "last")
           (command "purge" "Blocks" "Panel_wire_connection" "no")
           (if (vl-string-search "PB" xlno) (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/HPB11.dwg" (strcat (rtos (- ax 27.8577)) "," (rtos (- ay 10))) "1" "1" "0" "" "" "" "" "" "" "" "" "" "" "" "" "" "" xlno))
           (if (vl-string-search "M" xlno) (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/HCR21.dwg" (strcat (rtos (- ax 27.8577)) "," (rtos (- ay 10))) "1" "1" "0" "" "" "" "" "" "" "" "" "" "" "" "" xlno))
           (if (vl-string-search "LS" xlno) (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/HLS11.dwg" (strcat (rtos (- ax 27.8577)) "," (rtos (- ay 10))) "1" "1" "0" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" xlno))
           (if (vl-string-search "HLS" xlno) (command "-insert" "C:/Users/Cad_Machine_12/Desktop/stuff/IO DRAWINGS/HFL11.dwg" (strcat (rtos (- ax 27.8577)) "," (rtos (- ay 10))) "1" "1" "0" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" xlno))
         )
)
Title: Re: block insertion point problem
Post by: ChrisCarlson on August 30, 2019, 12:05:44 PM
Common problem add the following "_non" to the beginning of your insert line, just before the block insertion point.
Title: Re: block insertion point problem
Post by: Lee Mac on August 30, 2019, 12:18:41 PM
This answer (https://stackoverflow.com/questions/57253997/drawing-line-close-to-polyline/57258370#57258370) offers various methods describing how to avoid the influence of Object Snap when supplying point input to AutoCAD commands.
Title: Re: block insertion point problem
Post by: vincent.r on September 04, 2019, 05:21:20 AM
Common problem add the following "_non" to the beginning of your insert line, just before the block insertion point.

Thank you very much Master_Shake
Title: Re: block insertion point problem
Post by: vincent.r on September 04, 2019, 05:23:25 AM
This answer (https://stackoverflow.com/questions/57253997/drawing-line-close-to-polyline/57258370#57258370) offers various methods describing how to avoid the influence of Object Snap when supplying point input to AutoCAD commands.


Thanks Lee! You are always explanative. Everything clear about Osnap.