Converting from Lisp to VB

Discussion in 'AutoCAD' started by Soc, May 25, 2006.

  1. Soc

    Soc Guest

    Someone can help me to convert this code in Visual Basic language...
    lisp it is too much complicate for me and I need to use this code (from
    a friend of mine) for other puorpose like area compute, big selection
    manage...

    here is the code (sorry for my english):
    ----------------
    (defun c:Scrivi ()
    (setvar "cmdecho" 0)

    (setq NomeFile (getfiled "Salva file di Lunghezze" "" "csv" 1))
    (setq Separatore ";")

    (princ "\n Seleziona le Polilinee...")
    (setq gruppoDist(ssget (list (cons -4 "<OR")(cons 0 "POLYLINE")(cons 0
    "LWPOLYLINE")(cons -4 "OR>"))))
    (if gruppoDist (progn
    (setq i 0)
    (setq ListaProgr nil)
    (repeat (sslength gruppoDist)
    (setq poli(ssname gruppoDist i))
    (command "_area" "_o" poli)
    (if (assoc -3(entget poli '("SEZ")))
    (setq nome(cdr(car(cdr(car(cdr(assoc -3 (entget poli
    '("SEZ")))))))))
    (setq nome(strcat "Anonima_" (itoa i)))
    )
    (setq ListaProgr(cons (list nome (rtos(getvar "perimeter") 2 2))
    ListaProgr))
    (setq i(1+ i))
    )
    (setq ListaProgr(vl-sort ListaProgr (function (lambda (e1 e2) (< (car
    e1) (car e2))))))
    (setq i 0)
    (setq FF(open NomeFile "a"))
    (repeat (length ListaProgr)
    (write-line (strcat (nth 0 (nth i ListaProgr)) Separatore (nth 1 (nth
    i ListaProgr))) FF)
    (setq i(1+ i))
    )
    (close FF)
    (princ "\n Creato il file:")(princ NomeFile)
    )
    )
    (princ)

    )
    ;;;
    (defun c:Nome ()
    (if (not (tblsearch "appid" "SEZ"))(regapp "SEZ"))
    (if nome (princ (strcat "\n<Nome precedente: " nome "> ")))
    (setq nome(getstring " Nome sezione corrente: "))
    (setq pq1(append (entget (car (entsel))) (list (list -3 (list "SEZ"
    (cons 1000 nome))))))
    (entmod pq1)
    (princ)
    )
    ;;;
    (princ "\n <Copyright: ing. Claudio Granuzzo - 2006>")
    (princ "\n Digitare SCRIVI per scrivere nel file CSV")
    (princ "\n Digitare NOME per dare il nome alla sezione")
    (princ)
     
    Soc, May 25, 2006
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.