Jump to content

Recommended Posts

Posted

Hai, i need a help.

I have a working lisp routine which gives me distance(chainage) of polyline when clicked on the pline i selected. It will add a text there showing chainage.

Only thing i want is i need the chainage also in an external Excel Workbook cell. Like when i click and get the chainage there i want to get that chainage in excel workbook cell which is open (like Click to Xls lisp).

 

Pls reply if its possible... thanks

 

Attaching the lisp file and also adding same lisp code below.

;-- PIPE CHAINAGE abhi- CAA --
(defun c:CAA (/ s p c tp sch f)
(setvar "cmdecho" 0)
 (setq sch (getstring "\nSpecify start chainage : <0>"))			;"0" is set as the default value
  (if (= sch "")(setq sch "0"))
  (if
    (and (setq s (car (entsel "\nPick a polyline :")))
	 (or (= (cdr (assoc 0 (entget s))) "LWPOLYLINE")
	     (alert "Invalid object! Please pick a polyline only.")
	 )
    )
     (while
       (and
	 (setq
	   p (getpoint "\nSpecify point :")
	 )
	 (setq c (vlax-curve-getclosestpointto s p))
	 	 (setq tp (getpoint "\nSpecify Point for Text : "))
       )
	  (setq di (vlax-curve-getdistatpoint s c))
	  (setq f (fix (/ di 1000.0)))
	  (setq di (- di (*  f 1000.0)))
		(command "_.LEADER" c tp "" 
				(strcat "FF-LINE 01" )
				(strcat "CH=" (itoa (+ (atoi sch) f)) "+" (rtos di 2 3))
				""
		)
		(vlax-put-property (vlax-ename->vla-object (entlast)) 'height 3.50);;; Text Height 3.50
     )
  )
  (setvar "cmdecho" 1)
  (princ)
)
(vl-load-com)

 

LINE CHAIN & CORDS - CAA.LSP

Posted

I've been working on something similar, and while I haven't nailed it down myself, I can say it is indeed possible.

 

Perhaps this thread might help you out?: 

 

  • Like 1
Posted

I think the key to the next step is recording your text as you go, I would save that as list, 

put

 

(setq MyList (list))

 

somewhere near the beginning to make a blank list, then this bit to populate it all

 

(setq MyList (append MyList (strcat "FF-LINE 01" ) (strcat "CH=" (itoa (+ (atoi sch) f)) "+" (rtos di 2 3)) ))

 

I don't use spreadsheets a lot but once you have the text as a variable you can pass that to the next step to populate the spreadsheet.

 

if you want it a bit more manual than I would make a list with all the points, then write it to a deliminated text file, import that to excel after you have done the CAD stuff.

 

if you can get a LISP to update spreadsheet as you go then each loop set MyList as an empty list, write then text to it and then send to the spreadsheet

 

 

For now while you are waiting on an answer to the spreadsheet part, add in the text to a variable or list and it will be easier after that

 

 

  • Agree 2
Posted

Sorry but i don't know any basics of this coding. trying to learn but its so hard for me. i am a draftsman and so many lisp from here helped me a lot. 

 

Please let me know of this is possible in any ways. thanks.

 

Ive attached a sample of the existing lisp working and needed results in excel. Please check. thanks.

FF INTER CHAIN.dwg FF INTER CHAIN.xlsx

Posted

Any help on this one please. Could help me a lot.

Posted

If you just want the chainages then the simplest way is just make a csv file and open in excel.

 

Here in Aus we just use the CH 60190.345 much easier the + adds a complication as well as the Mtext which needs to be removed.

 

Need some time maybe some one else will jump in.

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...