Jump to content

Recommended Posts

Posted
I agree that no-one would really set it to 1, but I have seen examples in the past where Fixo sets Sys Vars differently... o:)

Then I retract my statement. :)

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    11

  • cadman2009

    8

  • fixo

    6

  • SteveK

    3

Top Posters In This Topic

Posted Images

Posted
Oh really, now I have to remember where all those drawings are saved I tried it on hehe

 

And actually I'd really like to know how to get "Command:" back?

 

 

I had to quit Acad and fire it up again to get "Command:" back.:x

Posted
I had to quit Acad and fire it up again to get "Command:" back.:x

Just type nomutt 1. You can't see it, but it will fix it.

Posted
Here is another one too big but with flowers :)

 

~'J'~

 

Dear fixo

Hi

when I use your code , after picking on a pline the below massage occurs :

 

Command: _appload PlineImport.LSP successfully loaded.

Command:

>>> Start command with PVI

Command:

Command: PVI

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

*Cancel*

*Cancel*

 

why ?

Posted
Dear fixo

Hi

when I use your code , after picking on a pline the below massage occurs :

 

Command: _appload PlineImport.LSP successfully loaded.

Command:

>>> Start command with PVI

Command:

Command: PVI

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

>>> Select polyline to import coordinates

*Cancel*

*Cancel*

 

why ?

 

See post #23

 

~'J'~

Posted
See post #23

 

~'J'~

Dear fixo

I make a 3dpoly and save it to c:\polytest.dwg and then load your code and type in command line pvi , after selecting polyline don't make any excel file and when I type nomutt 0 the command line appear and when I type nomutt in command line Disappear command line . However Is not made any excel file . I have this problem with 2 files :

plineImport.lsp and dwgtoexcel.lsp

please tell me how I can run these files step by step and where I must retrieved follow them .

thanks

Posted

Please try this instead CadMan, it works fastest if Excel is already open.

 

;; Polyline Vertex Exporter  ~   by Lee McDonnell  ~  27.11.2009

(defun c:pExp (/ *error* ObjRel ss col row ent tot j pt)
 (vl-load-com)

 (defun *error* (e)
   (ObjRel (list xlApp xlCells))
   (or (wcmatch (strcase e) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error : " e " **")))
   (princ))

 (defun ObjRel (lst)
   (mapcar
     (function
       (lambda (x)
         (if (and (eq (type x) 'VLA-OBJECT) (not (vlax-object-released-p x)))
           (vl-catch-all-apply 'vlax-release-object (list x))))) lst))

 (if  (setq i -1 ss (ssget '((0 . "*POLYLINE"))))
   (progn
     (setq xlApp     (vlax-get-or-create-object "Excel.Application")                
           xlCells   (vlax-get-property
                       (vlax-get-property
                         (vlax-get-property
                           (vlax-invoke-method
                             (vlax-get-property xlApp "Workbooks")
                             "Add")
                           "Sheets")
                         "Item" 1)
                       "Cells") col 0 row 1)

     (mapcar (function
               (lambda (x)
                 (vlax-put-property xlCells "Item" row (setq col (1+ col)) x)))
             '("Point""X""Y""Z""Distance""Total"))

     (while (setq ent (ssname ss (setq i (1+ i))))
       (setq tot 0. row (1+ row) j (1- (vlax-curve-getStartParam ent)))

       (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent))
         (setq col 0 pt (mapcar 'rtos (vlax-curve-getPointatParam ent j)))          

         (mapcar
           (function
             (lambda (x)
               (vlax-put-property xlCells "Item" row (setq col (1+ col)) x)))
           
           (list   (rtos (1+ j) 2 0)
                   (car pt)  (cadr pt) (caddr pt) 
                   (rtos (setq dis (- (vlax-curve-getDistatParam ent j)
                                      (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) 
                   (rtos (setq tot (+ dis tot)))))
         
         (setq row (1+ row))))
     
     (vlax-put-property xlApp 'Visible :vlax-true)
     (ObjRel (list xlApp xlCells))))

 (princ))

Posted
Dear fixo

I make a 3dpoly and save it to c:\polytest.dwg and then load your code and type in command line pvi , after selecting polyline don't make any excel file and when I type nomutt 0 the command line appear and when I type nomutt in command line Disappear command line . However Is not made any excel file . I have this problem with 2 files :

plineImport.lsp and dwgtoexcel.lsp

please tell me how I can run these files step by step and where I must retrieved follow them .

thanks

 

Ok, I see where I'm wrong, sorry

This one is working for me nice

I use A2008 an Excel 2003

Try it again

(Refresh my memory where is dwgtoexcel.lsp)

 

~'J'~

PlineImport.LSP

Posted
Please try this instead CadMan, it works fastest if Excel is already open.

 

;; Polyline Vertex Exporter  ~   by Lee McDonnell  ~  27.11.2009

(defun c:pExp (/ *error* ObjRel ss col row ent tot j pt)
 (vl-load-com)

 (defun *error* (e)
   (ObjRel (list xlApp xlCells))
   (or (wcmatch (strcase e) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error : " e " **")))
   (princ))

 (defun ObjRel (lst)
   (mapcar
     (function
       (lambda (x)
         (if (and (eq (type x) 'VLA-OBJECT) (not (vlax-object-released-p x)))
           (vl-catch-all-apply 'vlax-release-object (list x))))) lst))

 (if  (setq i -1 ss (ssget '((0 . "*POLYLINE"))))
   (progn
     (setq xlApp     (vlax-get-or-create-object "Excel.Application")                
           xlCells   (vlax-get-property
                       (vlax-get-property
                         (vlax-get-property
                           (vlax-invoke-method
                             (vlax-get-property xlApp "Workbooks")
                             "Add")
                           "Sheets")
                         "Item" 1)
                       "Cells") col 0 row 1)

     (mapcar (function
               (lambda (x)
                 (vlax-put-property xlCells "Item" row (setq col (1+ col)) x)))
             '("Point""X""Y""Z""Distance""Total"))

     (while (setq ent (ssname ss (setq i (1+ i))))
       (setq tot 0. row (1+ row) j (1- (vlax-curve-getStartParam ent)))

       (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent))
         (setq col 0 pt (mapcar 'rtos (vlax-curve-getPointatParam ent j)))          

         (mapcar
           (function
             (lambda (x)
               (vlax-put-property xlCells "Item" row (setq col (1+ col)) x)))
           
           (list   (rtos (1+ j) 2 0)
                   (car pt)  (cadr pt) (caddr pt) 
                   (rtos (setq dis (- (vlax-curve-getDistatParam ent j)
                                      (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) 
                   (rtos (setq tot (+ dis tot)))))
         
         (setq row (1+ row))))
     
     (vlax-put-property xlApp 'Visible :vlax-true)
     (ObjRel (list xlApp xlCells))))

 (princ))

 

Thanks LEE

it works correctly like your other programs

Posted
Thanks LEE

it works correctly like your other programs

 

You're welcome CadMan :)

Posted
Ok, I see where I'm wrong, sorry

This one is working for me nice

I use A2008 an Excel 2003

Try it again

(Refresh my memory where is dwgtoexcel.lsp)

 

~'J'~

Dear sir

I thanks very much , Please Excuse me as to why I insisted something I repeated questions .

Posted
Dear sir

I thanks very much , Please Excuse me as to why I insisted something I repeated questions .

 

No worries, please :)

Ask me again and again

You helped me too to find the mistakes

Regards,

 

~'J'~

  • 3 years later...
Posted

There is a way to associate info export with the name of layer like this; buts this only take area

 

(defun c:pline-area ( / *error* data-lst sorted-lst str-lst top-str polys

data cnt obj file-nm tmp item tmp-str fl)

 

(defun *error* (msg)

(if(= msg "quit / exit abort")

(princ "\nNo output file was selected")

(princ msg)

)

)

 

(setq top-str ""

file-nm (getfiled "Output File" "" "doc" 1)

)

(if(null file-nm)(exit))

(if(setq polys(ssget '((0 . "*POLYLINE"))))

(repeat(setq cnt(sslength polys))

(setq obj (vlax-ename->vla-object

(ssname polys

(setq cnt(1- cnt))

)

)

data-lst (cons

(list(vlax-get obj 'Layer)

(vlax-get obj 'Area)

)

data-lst

)

)

)

)

(while data-lst

(setq data (car data-lst)

data-lst (cdr data-lst)

tmp (list data)

)

(foreach item data-lst

(if(=(car item)(car data))

(setq tmp (cons item tmp)

data-lst (vl-remove item data-lst)

)

)

)

(setq sorted-lst(cons tmp sorted-lst))

)

(setq sorted-lst

(vl-sort sorted-lst '(lambda(a b)(

)

(foreach item (reverse sorted-lst)

(setq top-str

(strcat(caar item)"," top-str)

)

)

(setq str-lst (cons top-str str-lst)

cnt 0

)

(repeat(apply 'max(mapcar 'length sorted-lst))

(setq tmp-str "")

(foreach item (reverse sorted-lst)

(setq tmp-str

(if(setq tmp(nth cnt item))

(strcat(rtos(cadr tmp)) "," tmp-str)

(strcat "," tmp-str)

)

)

)

(setq cnt (1+ cnt)

str-lst (cons tmp-str str-lst)

)

)

(if(setq fl(open file-nm "w"))

(progn

(foreach str (reverse str-lst)

(write-line str fl)

)

(close fl)

(alert(strcat file-nm " was created"))

)

(alert "Unable to create file")

)

(princ)

)

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...