export Coordinates from CAD to Excel

export Coordinates from CAD to Excel

iftikharahmed_arain
Participant Participant
11,136 Views
8 Replies
Message 1 of 9

export Coordinates from CAD to Excel

iftikharahmed_arain
Participant
Participant

I capture the coordinates from Cad drawing and manually transfer the detail by key board on a spread sheet. these Coordinates are captured related to multiple objects and during the process I set up local UCS for each object. There are lot of chances to enter wrong detail on spread sheet during typing. Is there any way, I could transfer this detail without typing? I mean, if some one to kindly  create a Lisp for this purpose or if there is any other solution. I have attached a Screencast recording , Cad drawing and spread sheet used in the recording.

0 Likes
Accepted solutions (1)
11,137 Views
8 Replies
Replies (8)
Message 2 of 9

john.uhden
Mentor
Mentor

Ouch.  That's like laying sod one blade of grass at a time or painting a house with a mascara brush.

 

Sorry, I haven't messed with AutoCAD<->Excel in quite some time so I am very rusty.

John F. Uhden

0 Likes
Message 3 of 9

wkmvrij
Advocate
Advocate

It is common practice nowadays to have AutoCad write values into an Excel worksheet. Examples to make the connection are multitude on this forum alone already. Unfortunately there is no way to establish which coordinates you wish to write to your Excel sheet from what you have given as information.I could not run your MP4 file. From the Excel example I could not deduce a logical structure. Please give a description of what exactly you want written to Excel?

0 Likes
Message 4 of 9

iftikharahmed_arain
Participant
Participant

I have inserted screencast recording, hope it will be clear what detail I want to transfer from Autocad to excel sheet. Thanks for your interest to help me. 

0 Likes
Message 5 of 9

wkmvrij
Advocate
Advocate

Following is to be considered as PROOF OF CONCEPT!

 

As I read the problem I condense it as follows.

 

For the production of railway switches a number of location specific (concrete) RAILWAY SLEEPERS need to be produced. For the production of these sleepers clamps holding the rail profiles are to be placed in defined locations and orientation, referenced from the base point of each mold.

 

 

iftikharahmed.arain gave a DWG file + EXCEL file as example but the EXCEL file already contains all coordinates. So treating the given DWG file is trivial.

 

The given function selects all lines within one sleeper (the vertical rectangle on layer "1") and writes the coordinates to an EXCEL file. Analysing these coordinates would give location and orientation of these clamps. For am more useful application one would expect to treat a number of similar DWG files, so that each sleeper can be defined from them, but then the DWG files would have to adhere to a given pattern

 

For the clamps to appear in each sleeper I exploded the block 'housings'. One clamp would then be a group of three lines having end or start point in common Other camping devices seem to be present in this DWG and might be treated similarly

 

 

This analysis would be possible but a major undertaking. I gladly recommend this to gurus of better standing than myself or any other person with several days of working time available..

 

 

(DEFUN railwaysleepers (/ p1 p2 ss XL xlBook xlSheet n obj)
  (DEFUN con-excel (/ XL)
    (OR	(SETQ XL (VLAX-GET-OBJECT "Excel.Application"))
	(SETQ XL (VLAX-CREATE-OBJECT "Excel.Application"))
    )
    XL
  )
  (DEFUN putcel	(Sheet row column val /)
    (VLAX-PUT (VLAX-GET-PROPERTY Sheet 'Range (STRCAT column (ITOA row)))
	      'VALUE
	      val
    )
  )
  (AND (OR (SETQ XL (con-excel))
	   (ALERT "Could not load Excel. Sorry")
	   (EXIT)
       ) ;_ end of or
       (NOT (VLAX-PUT XL 'Visible :VLAX-TRUE))
       (OR (AND	(SETQ xlBook (VLAX-INVOKE (VLAX-GET XL 'Workbooks) 'Add) ;_ end of vlax-invoke
		)
		(SETQ xlSheet (VLAx-GET xlBook 'ActiveSheet))
	   )
	   (IF XL
	     (SETQ XL (VLAX-INVOKE xl 'QUIT))
	   )
	   (ALERT "Could not find worksheet. Sorry")
	   (EXIT)
       )
  )
  (COMMAND "UCS" "W")
  (SETQ	p2 (GETCORNER (SETQ p1 (GETPOINT "\nPick LeftBottom"))
		      "\nPick Right Top"
	   )
  )
  (AND (SETQ n -1)
       (SETQ ss (SSGET "W" p1 p2))
       (WHILE (< (SETQ n (1+ n)) (SSLENGTH SS))
	 (IF
	   (= (VLAX-GET	(SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS n)))
			'OBJECTNAME
	      )
	      "AcDbLine"
	   )
	    (PROGN
;;;	 (vlax-dump-object obj T)		   
		   (SETQ SP (VLAX-SAFEARRAY->LIST
			      (VLAX-VARIANT-VALUE (VLA-GET-STARTPOINT obj))
			    )
			 EP (VLAX-SAFEARRAY->LIST
			      (VLAX-VARIANT-VALUE (VLA-GET-ENDPOINT obj))
			    )
		   )
		   (putcel xlSheet (1+ n) "A" (CAR SP))
		   (putcel xlSheet (1+ n) "B" (CADR SP))
		   (putcel xlSheet (1+ n) "C" (CAR EP))
		   (putcel xlSheet (1+ n) "D" (CADR EP))
		   (putcel xlSheet (1+ n) "E" (VLAX-GET OBJ 'LENGTH))
	    )
	 )
       )
  )
  (IF XL
    (SETQ XL (VLAX-INVOKE xl 'QUIT))
  )
)

 

0 Likes
Message 6 of 9

Ranjit_Singh
Advisor
Advisor
Accepted solution

Hi iftikharahmed, see below code for example. I am using the spreadsheet you provided, but one could write to any excel file.

;;;Insert CAD co-ordinates to Excel. Written for @iftikharahmed.arain at
;;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/export-coordinates-from-cad-to-excel/td-p/6921761
;;;Created by Ranjit Singh 03/06/2017

(defun c:somefunc  (/ actsht curcell curcellstr filep p1 rply wkbk xclobj)
 (setq actsht (vlax-get (setq wkbk (vlax-invoke (vlax-get (setq xclobj (vlax-get-or-create-object "excel.application")) 'workbooks)
                         'add
                         (setq filep (getfiled "Select excel file" "" "xlsx" 0)))) 'activesheet)
       curcellstr "C9"
       curcell    (vlax-get-property actsht 'range curcellstr)
       rply       "Yes")
 (while (= rply "Yes")
  (command-s "._ucs" 3 "_int" pause "_int" pause "_perp" pause)
  (while (setq p1 (getpoint "\nSelect first point to ID: "))
   (mapcar '(lambda (x) (vlax-put (setq curcell (vlax-get curcell 'next)) 'value x))
           (append (reverse (cdr (reverse p1)))
                         (list (* 180.0 (/ (getangle p1 "\nSelect point for angle: ") pi)))
                         (reverse (cdr (reverse (getpoint "\nSelect second point to ID: ")))))))
  (setq curcellstr (strcat "C" (itoa (1+ (atoi (substr curcellstr 2)))))
        curcell    (vlax-get-property actsht 'range curcellstr))
  (initget "Yes Exit")
  (setq rply (getkword "\nMove to new row [Yes/Exit] <Yes> :"))
  (if (null rply)
   (setq rply "Yes")))
 (vlax-invoke wkbk 'saveas filep)
 (vlax-invoke wkbk 'close)
 (vlax-release-object xclobj)
 (princ))

Add error trap if you end up using it. Also note that no check is done to match the 5 digit numbers to the excel sheet. The routine adds data sequentially to excel. So picking in correct order is necessary. When you need to switch to the next row in excel, say "Yes" at prompt or it will continue writing in the same row. Hope this saves you some time.

 

0 Likes
Message 7 of 9

wkmvrij
Advocate
Advocate

So out of pure boredom I decided to take the matter a step further and went on to develop the harvesting of the required data. 

 

First of all, I read the remarks, present in the example drawing. They say, that these switch layouts are computer generated, and that a specific symbol is used for these rail clips. That gave me confidence as to the selection of the "data bearing" elements in the drawing. I will not elaborate further on the way the coordinates should be established. I simply used the lines with a length of 24 mm that are drawn with a start point on the required coordinate, and in an orientation as drawn, 

 

These clips symbols in the example drawing are partially represented as lines and partly appear in a block. called "housing" This block needs to be exploded before any extraction can be done. 

 

A further remark in on the Excel file. Each line in the file represent a set of clips grouped in a series of 4. However per sleeper there are 8 clips, ie. 4 pairs of two. with each pair an angle of let us say 0 but the angle for the other at an angle of 180. 

 

The proposed LSP will start EXCEL, add a book and will write a kind of header showing the various coordinates. Then the user can select a sleeper, (the green rectangle) and the function will write out the entire set of coordinates and orientation for the clips present on that sleeper. It will continue to do so until the user wants to stop for coffee.

 

Please note, that this function is valid only for the presented example DWG. Only drawings that are made with the same method (CAD routine) can be treated.!

 

(DEFUN railwaysleepers (/      p1     p2     ss	    ss1	   XL
			xlBook xlSheet	     n	    obj	   SP
			EP     LEN    pref   pinsert	   sleeperno
			keyw
		       )
  (DEFUN con-excel (/ XL)
    (OR	(SETQ XL (VLAX-GET-OBJECT "Excel.Application"))
	(SETQ XL (VLAX-CREATE-OBJECT "Excel.Application"))
    )
    XL
  )
  (DEFUN putcel	(Sheet row column val /)
    (VLAX-PUT (VLAX-GET-PROPERTY Sheet 'Range (STRCAT column (ITOA row)))
	      'VALUE
	      val
    )
  )
  (DEFUN midpoint (p1 p2 /)
    (MAPCAR '(LAMBDA (x) (* x 0.5)) (MAPCAR '+ p1 p2))
  )
  (DEFUN rtod (a) (* 180.0 (/ a PI)))
  (DEFUN vecadd	(v1 v2 / res counter)
    ((AND (= (TYPE v1) 'LIST) (= (TYPE v2) 'LIST)) ;_ end of and
      (MAPCAR '+ v1 v2)
    )
  )
  (AND (SETQ keyw "Yes")
       (OR (SETQ XL (con-excel))
	   (ALERT "Could not load Excel. Sorry")
	   (EXIT)
       ) ;_ end of or
       (NOT (VLAX-PUT XL 'Visible :VLAX-TRUE))
       (OR (AND	(SETQ xlBook (VLAX-INVOKE (VLAX-GET XL 'Workbooks) 'Add) ;_ end of vlax-invoke
		)
		(SETQ xlSheet (VLAX-GET xlBook 'ActiveSheet))
	   )
	   (IF XL
	     (SETQ XL (VLAX-INVOKE xl 'QUIT))
	   )
	   (ALERT "Could not find worksheet. Sorry")
	   (EXIT)
       )
  )
  (COMMAND "UCS" "W")
  (putcel xlSheet 5 "A" "Sleeper No.")
  (putcel xlSheet 5 "B" "Length")
  (putcel xlSheet 5 "C" "Reference")
  (SETQ n -1)
  (WHILE (< (SETQ n (1+ n)) 8)
    (putcel xlSheet
	    5
	    (IF	(<= (SETQ col (+ (* 3 N) 68)) 90)
	      (CHR col)
	      (STRCAT "A" (CHR (- COL 26)))
	    )
	    (STRCAT "X" (ITOA (1+ n)))
    )
    (putcel xlSheet
	    5
	    (IF	(<= COL 89)
	      (CHR (1+ COL))
	      (STRCAT "A" (CHR (1+ (- COL 26))))
	    )
	    (STRCAT "Y" (ITOA (1+ n)))
    )
    (putcel xlSheet
	    5
	    (IF	(<= COL 88)
	      (CHR (+ COL 2))
	      (STRCAT "A" (CHR (+ (- COL 26) 2)))
	    )
	    (STRCAT "ANGLE" (ITOA (1+ n)))
    )
  )
  (WHILE (NOT (= keyw "No"))
    (SETQ p2 (GETCORNER	(SETQ p1 (GETPOINT "\nPick LeftBottom"))
			"\nPick Right Top"
	     )
    )
;;; Retrive Sleeper particulars:
    (AND
      (SETQ n -1)
      (SETQ ss1
	     (SSGET "W" (vecadd p1 '(-12 -895)) (vecadd p1 '(277 -760)))
      )
      (NOT (WHILE (< (SETQ n (1+ n)) (SSLENGTH ss1))
	     (IF (= (VLAX-GET
		      (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS1 n)))
		      'OBJECTNAME
		    )
		    "AcDbMText"
		 )
	       (putcel
		 xlSheet
		 (+ 5 (SETQ sleeperno (ATOI (VLAX-GET obj 'TextString))))
		 "A"
		 (VLAX-GET obj 'TextString)
	       )
	     )
	   )
      )
      (SETQ n -1)
      (SETQ ss1
	     (SSGET "W" (vecadd p1 '(-232 -606)) (vecadd p1 '(497 -750)))
      )
      (NOT (WHILE (< (SETQ n (1+ n)) (SSLENGTH ss1))
	     (IF (= (VLAX-GET
		      (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS1 n)))
		      'OBJECTNAME
		    )
		    "AcDbMText"
		 )
	       (putcel xlSheet
		       (+ 5 sleeperno)
		       "C"
		       (VLAX-GET obj 'TextString)
	       )
	     )
	   )
      )
    )
;;; Sleeper overview:
    (AND
      (SETQ pref nil
	    pinsert nil
	    n -1
      )
      (SETQ ss (SSGET "W" p1 p2))
      (WHILE (< (SETQ n (1+ n)) (SSLENGTH SS))
	(IF
	  (= (VLAX-GET (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS n)))
		       'OBJECTNAME
	     )
	     "AcDbLine"
	  )
	   (PROGN
	     (SETQ SP  (VLAX-SAFEARRAY->LIST
			 (VLAX-VARIANT-VALUE (VLA-GET-STARTPOINT obj))
		       )
		   EP  (VLAX-SAFEARRAY->LIST
			 (VLAX-VARIANT-VALUE (VLA-GET-ENDPOINT obj))
		       )
		   Len (VLAX-GET OBJ 'LENGTH)
	     )
;;;Establish Sleeper reference point:
	     (IF (AND (= (CADR SP) (CADR EP))
		      ;;Line is horizontal and color is green (3)
		      (= (VLA-GET-COLOR obj) 3)
		 )
	       (PROGN (IF (AND (NULL pref) (SETQ pref (midpoint SP EP)))
			(IF (< (CADR SP) (CADR pref))
			  (SETQ pref (midpoint SP EP))
			)
		      )
	       )
	     )
;;; Establish colletion of clamps inserts:
	     (IF (AND (= (VLA-GET-COLOR obj) 2)
		      (= (VLA-GET-LAYER obj) "1")
		      (NOT (= len 38.0))
		 )
	       (PROGN
		 (SETQ ang (- (rtod (ANGLE EP SP)) 90))
		 (COND
		   ((NULL pinsert) (SETQ pinsert (LIST (CONS SP ang))))
		   ((AND (<= 1 (LENGTH pinsert)) (ASSOC sp pinsert))
		    nil
		   )
		   (T (SETQ pinsert (CONS (CONS SP ang) PINSERT)))
		 )
	       )
	     )
	   )
	)
      )
    )
;;; Sort pinsert Bottom to Top:
    (SETQ pinsert (VL-SORT
		    pinsert
		    (FUNCTION
		      (LAMBDA (e1 e2) (< (CADR (CAR e1)) (CADR (CAR e2))))
		    )
		  )
	  n	  0
    )
    (FOREACH ins pinsert
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (CHR (+ n 68))
	      (- (CAAR ins) (CAR pref))
      )
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (CHR (+ n 69))
	      (- (CADAR ins) (CADR pref))
      )
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (IF (< (+ n 70) 90)
		(CHR (+ n 70))
		(STRCAT "A" (CHR (- (+ n 70) 26)))
	      )
	      (CDR ins)
      )
      (SETQ n (+ 3 n))
    )
    (INITGET 0 "Yes No")
    (IF
      (NOT (= (SETQ keyw (GETKWORD "\nContinue? [Yes / No] <Y>")) "No"))
       (SETQ keyw "Yes")
    )
  )
;;;  (IF (AND XL xlBook)
;;;    (SETQ xlBook (VLAX-INVOKE
;;;		   xlBook
;;;		   'SAVEAS
;;;		   "C:\\DATA\\Acad\\LSP\\WEB\\SEM.xlsx"
;;;		 )
;;;	  XL	 (VLAX-INVOKE xl 'QUIT)
;;;    )
;;;  )
)
0 Likes
Message 8 of 9

iftikharahmed_arain
Participant
Participant

Excellent solution provided by Ranjit Singh. The Lisp code was to the point and so simple to understand for the person like me who never used Lisp before. it was so easy that I managed to edit this code to create a new code for a different type of coordinates (requiring no angle). It was explained well step by step how to run the Lisp code. 

When I put my post on forum ,I just asked for simply exporting data from CAD to Excel and attached a simple CAD drawing and Excel data file to avoid make it complicated so that you guys on forum easily understand what I need because I was not sure in getting any solution but thanks to Ranjit he done it.  The code provided by Ranjit Singh helpful for me to export 90% of data from CAD to Excel, I need some amendment in the code and also there are some other additional detail that also required to export to excel file explained as under; I have attached CAD and excel files. I have deleted 90% detail in these files for clarity. 

1. 90% of Rail seats require 2 sets of rail clips but at some position require only 1 rail clip as shown in drawing for sleeper no's 109 to 112.

    a. Refer excel file- sleeper no. 109, Rail seat B with 1 Clip, how I can skip Column L & M after capturing angle & coordinates of clip no. 3

        Rail seat C with 1 clip, how I can skip columns N & O then to capture angle & coordinates of clip no. 6.

2. Sometime I need to export some other additional details as shown in tabs on excel file

     a. Insulator Clips.  Only one position of Clip with  XY Coordinates & angle.

     b. Vossloh Inserts. Only XY Coordinates, no angle required.

     Is it possible to export data in other  tab on excel file? 

If solution not possible for above both items 1 & 2, Is it possible to pause using Code and to put detail manually by keyboard then again resume to export detail by code.

     

    

 

0 Likes
Message 9 of 9

wkmvrij
Advocate
Advocate

Some debugging .... Should work now 🙂

(DEFUN c:railwaysleepers (/      p1     p2     ss	    ss1	   XL
			xlBook xlSheet	     n	    obj	   SP
			EP     LEN    pref   pinsert	   sleeperno
			keyw
		       )
  (DEFUN con-excel (/ XL)
    (OR	(SETQ XL (VLAX-GET-OBJECT "Excel.Application"))
	(SETQ XL (VLAX-CREATE-OBJECT "Excel.Application"))
    )
    XL
  )
  (DEFUN putcel	(Sheet row column val /)
    (VLAX-PUT (VLAX-GET-PROPERTY Sheet 'Range (STRCAT column (ITOA row)))
	      'VALUE
	      val
    )
  )
  (DEFUN midpoint (p1 p2 /)
    (MAPCAR '(LAMBDA (x) (* x 0.5)) (MAPCAR '+ p1 p2))
  )
  
  (DEFUN rtod (a) (* 180.0 (/ a PI)))
  
  (DEFUN vecadd	(v1 v2 / res)
    (if (AND (= (TYPE v1) 'LIST) (= (TYPE v2) 'LIST)) ;_ end of and
      (setq res (MAPCAR '+ v1 v2))
    )
    res
  )
  (AND (SETQ keyw "Yes")
       (OR (SETQ XL (con-excel))
	   (ALERT "Could not load Excel. Sorry")
	   (EXIT)
       ) ;_ end of or
       (NOT (VLAX-PUT XL 'Visible :VLAX-TRUE))
       (OR (AND	(SETQ xlBook (VLAX-INVOKE (VLAX-GET XL 'Workbooks) 'Add) ;_ end of vlax-invoke
		)
		(SETQ xlSheet (VLAX-GET xlBook 'ActiveSheet))
	   )
	   (IF XL
	     (SETQ XL (VLAX-INVOKE xl 'QUIT))
	   )
	   (ALERT "Could not find worksheet. Sorry")
	   (EXIT)
       )
  )
  (COMMAND "UCS" "W")
  (putcel xlSheet 5 "A" "Sleeper No.")
  (putcel xlSheet 5 "B" "Length")
  (putcel xlSheet 5 "C" "Reference")
  (SETQ n -1)
  (WHILE (< (SETQ n (1+ n)) 8)
    (putcel xlSheet
	    5
	    (IF	(<= (SETQ col (+ (* 3 N) 68)) 90)
	      (CHR col)
	      (STRCAT "A" (CHR (- COL 26)))
	    )
	    (STRCAT "X" (ITOA (1+ n)))
    )
    (putcel xlSheet
	    5
	    (IF	(<= COL 89)
	      (CHR (1+ COL))
	      (STRCAT "A" (CHR (1+ (- COL 26))))
	    )
	    (STRCAT "Y" (ITOA (1+ n)))
    )
    (putcel xlSheet
	    5
	    (IF	(<= COL 88)
	      (CHR (+ COL 2))
	      (STRCAT "A" (CHR (+ (- COL 26) 2)))
	    )
	    (STRCAT "ANGLE" (ITOA (1+ n)))
    )
  )
  (WHILE (NOT (= keyw "No"))
    (SETQ p2 (GETCORNER	(SETQ p1 (GETPOINT "\nPick LeftBottom"))
			"\nPick Right Top"
	     )
    )
;;; Retrieve Sleeper particulars:
    (AND
      (SETQ n -1)
      (SETQ ss1
	     (SSGET "W" (vecadd p1 '(-12 -895)) (vecadd p1 '(277 -760)))
      )
      (NOT (WHILE (< (SETQ n (1+ n)) (SSLENGTH ss1))
	     (IF (= (VLAX-GET
		      (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS1 n)))
		      'OBJECTNAME
		    )
		    "AcDbMText"
		 )
	       (putcel
		 xlSheet
		 (+ 5 (SETQ sleeperno (ATOI (VLAX-GET obj 'TextString))))
		 "A"
		 (VLAX-GET obj 'TextString)
	       )
	     )
	   )
      )
      (SETQ n -1)
      (SETQ ss1
	     (SSGET "W" (vecadd p1 '(-232 -606)) (vecadd p1 '(497 -750)))
      )
      (NOT (WHILE (< (SETQ n (1+ n)) (SSLENGTH ss1))
	     (IF (= (VLAX-GET
		      (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS1 n)))
		      'OBJECTNAME
		    )
		    "AcDbMText"
		 )
	       (putcel xlSheet
		       (+ 5 sleeperno)
		       "C"
		       (VLAX-GET obj 'TextString)
	       )
	     )
	   )
      )
    )
;;; Sleeper overview:
    (AND
      (SETQ pref nil
	    pinsert nil
	    n -1
      )
      (SETQ ss (SSGET "W" p1 p2))
      (WHILE (< (SETQ n (1+ n)) (SSLENGTH SS))
	(IF
	  (= (VLAX-GET (SETQ obj (VLAX-ENAME->VLA-OBJECT (SSNAME SS n)))
		       'OBJECTNAME
	     )
	     "AcDbLine"
	  )
	   (PROGN
	     (SETQ SP  (VLAX-SAFEARRAY->LIST
			 (VLAX-VARIANT-VALUE (VLA-GET-STARTPOINT obj))
		       )
		   EP  (VLAX-SAFEARRAY->LIST
			 (VLAX-VARIANT-VALUE (VLA-GET-ENDPOINT obj))
		       )
		   Len (VLAX-GET OBJ 'LENGTH)
	     )
;;;Establish Sleeper reference point:
	     (IF (AND (= (CADR SP) (CADR EP))
		      ;;Line is horizontal and color is green (3)
		      (= (VLA-GET-COLOR obj) 3)
		 )
	       (PROGN (IF (AND (NULL pref) (SETQ pref (midpoint SP EP)))
			(IF (< (CADR SP) (CADR pref))
			  (SETQ pref (midpoint SP EP))
			)
		      )
	       )
	     )
;;; Establish colletion of clamps inserts:
	     (IF (AND (= (VLA-GET-COLOR obj) 2)
		      (= (VLA-GET-LAYER obj) "1")
		      (NOT (= len 38.0))
		 )
	       (PROGN
		 (SETQ ang (- (rtod (ANGLE EP SP)) 90))
		 (COND
		   ((NULL pinsert) (SETQ pinsert (LIST (CONS SP ang))))
		   ((AND (<= 1 (LENGTH pinsert)) (ASSOC sp pinsert))
		    nil
		   )
		   (T (SETQ pinsert (CONS (CONS SP ang) PINSERT)))
		 )
	       )
	     )
	   )
	)
      )
    )
;;; Sort pinsert Bottom to Top:
    (SETQ pinsert (VL-SORT
		    pinsert
		    (FUNCTION
		      (LAMBDA (e1 e2) (< (CADR (CAR e1)) (CADR (CAR e2))))
		    )
		  )
	  n	  0
    )
    (FOREACH ins pinsert
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (CHR (+ n 68))
	      (- (CAAR ins) (CAR pref))
      )
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (CHR (+ n 69))
	      (- (CADAR ins) (CADR pref))
      )
      (putcel xlSheet
	      (+ 5 sleeperno)
	      (IF (< (+ n 70) 90)
		(CHR (+ n 70))
		(STRCAT "A" (CHR (- (+ n 70) 26)))
	      )
	      (CDR ins)
      )
      (SETQ n (+ 3 n))
    )
    (INITGET 0 "Yes No")
    (IF
      (NOT (= (SETQ keyw (GETKWORD "\nContinue? [Yes / No] <Y>")) "No"))
       (SETQ keyw "Yes")
    )
  )
;;;  (IF (AND XL xlBook)
;;;    (SETQ xlBook (VLAX-INVOKE
;;;		   xlBook
;;;		   'SAVEAS
;;;		   "C:\\DATA\\Acad\\LSP\\WEB\\SEM.xlsx"
;;;		 )
;;;	  XL	 (VLAX-INVOKE xl 'QUIT)
;;;    )
;;;  )
0 Likes