Author Topic: R12 polylines  (Read 7755 times)

0 Members and 1 Guest are viewing this topic.

jbaxter

  • Guest
Re: R12 polylines
« Reply #15 on: September 21, 2006, 11:24:59 PM »
Thanks Jeff,

I have not as yet attempted to import into r12 (r12 machine not in the office with me as it is at home ready for me to overcome this problem:-) however when I exported contours out of 2002 and then for interest sake did an import back into the same r2002 drawing  I got an interesting result, the unsmoothed contours came in okay however were not exactly over the top of the original contours (offset?) and the spline smoothed original contours ended as a mess of zig-zags when imported.

I think this is on the right track though and worth pursuing I think.

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #16 on: September 23, 2006, 03:42:55 PM »
Hi John,
Could you post your drawing? I just tested, again, with straight LWPlines, arced LWPlines, Curve-fit plines and Spline-fit plines. Every one of them came back in exactly on top of the original. IOW, I haven't been able to duplicate the issues you brought up, but would like to figure out why.....

jbaxter

  • Guest
Re: R12 polylines
« Reply #17 on: September 25, 2006, 12:51:42 AM »
Hi Jeff,

Here are the contours, before and after.

regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #18 on: September 25, 2006, 12:20:35 PM »
OK, I see that I forgot that coordinates don't get output correctly in a normal list listing.......this revised code works on your BEFORE drawing quite well.
Code: [Select]
(defun exportplinestor12 (/ ss idx ffile ent elist)
  (if (setq ss (ssget '((0 . "*POLYLINE"))))
    (progn
      (command "_undo" "_be")
      (command "_convertpoly" "_h" ss "")
      (setq idx -1
    ffile (open "c:\\plinexport.txt" "W")
    )
      (while (setq ent (ssname ss (setq idx (1+ idx))))
(while (/= "SEQEND" (cdr (assoc 0 (setq elist (vl-remove-if
'(lambda (x / code)
   (setq code (car x))
   (or (= code -1)
       (= code -2)
       (= code 5)
       (= code 330)
       (= code 340)
       (= code 100)
       (= code 410)
       )
   )
(entget ent))))))
  (setq assoc10 (cdr (assoc 10 elist)))
  (setq elist (vl-remove (assoc 10 elist) elist))
  (if (and (assoc 70 elist)
   (= 128 (logand (cdr (assoc 70 elist)) 128))
   )
    (setq elist (subst (cons 70 (- (cdr (assoc 70 elist)) 128)) (assoc 70 elist) elist))
    )
  (setq line2write (vl-prin1-to-string elist))
  (setq line2write (strcat (substr line2write 1 (1- (strlen line2write)))
   " (10 "
     (rtos (car assoc10) 2 8)
   " "
     (rtos (cadr assoc10) 2 8)
   " "
     (rtos (caddr assoc10) 2 8)
     "))"      
   ))
  (write-line line2write ffile)
  (setq ent (entnext ent))
  )
(write-line (vl-prin1-to-string elist) ffile)
)
      (close ffile)
      (command "_undo" "_end")
      (command "u")
      )
    )
  )
I should note that the import function will not work correctly when you are importing into a drawing that does not have the linetypes defined in it that the plines use. As that is something that can be checked/coded fairly easily I'll leave that for you to do. If it were me, I'd just change them all to bylayer before exporting.

jbaxter

  • Guest
Re: R12 polylines
« Reply #19 on: September 25, 2006, 07:43:44 PM »
Thank you for your time on this Jeff, I will give it a go today.

Regards,
JB

jbaxter

  • Guest
Re: R12 polylines
« Reply #20 on: September 25, 2006, 11:32:30 PM »
Hi Jeff,

That worked fine exporting and re-inserting back into r2002, I will set it up for R12 and give that a try and let you know.

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #21 on: September 28, 2006, 02:13:01 PM »
....., I will set it up for R12 and give that a try and let you know.

Regards,
John
Well? I'm curious and I can't find a computer around here with a floppy drive so I can't install R12 to try it myself.

jbaxter

  • Guest
Re: R12 polylines
« Reply #22 on: January 08, 2007, 08:06:02 AM »
Hi Jeff,

I am back at this again. :-)

I am using a pure dos system with r12 acad installed so the old 8.3 filenames are imposed, I think that is stopping the importplinestor12 command from working as I am getting an unknown command error.

Regards,
John


Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #23 on: January 08, 2007, 01:50:47 PM »
Hi John,
You will need to refresh your memory on how to implement the utilities. :-) I know I did.....

Look back 9-10 messages and see that I did not set these up to be commands, but rather they are functions and need to be issued like so:

Command: (importplinestor12)

Hope that works, as I don't recall there being a limitation on the length of function names.

jbaxter

  • Guest
Re: R12 polylines
« Reply #24 on: January 08, 2007, 11:44:57 PM »
Hi Jeff,

Yep I dare say I could use a refresher on r12 stuff  :-) however I am invoking with (importplinestor12) but is returning NIL at the command prompt within R12?

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #25 on: January 09, 2007, 12:11:55 AM »
Hi John,
It should return nil, but I should have had it return T if successful or nil if not. Did you try to ZOOM Extents to see if the plines were imported?
Code: [Select]
(defun importplinestor12 (/ ffile line)
  (if (setq ffile (open "c:\\plinexport.txt" "R"))
    (progn
      (while (setq line (read-line ffile))
(entmake (read line))
)
      (close ffile)
      T
      )
    (princ "\n...file to import not found....")
    )
  )
Sorry, without R12 here I'm really just grasping at straws......

Jeff

jbaxter

  • Guest
Re: R12 polylines
« Reply #26 on: January 09, 2007, 02:24:01 AM »
Hi Jeff,

I really appreciate your help with this, I know it is difficult when you cannot test it.

I think we are sneaking up on it. I will give the code a try tonight and let you know how it goes. I still there is an issue with the 8.3 rule as a dos system will change the filename to plineexp~1.txt and I think would upset the lisp file call function, anyway I will fiddle around with it and see if I can get it to work.

Does renaming the plinexport.txt to .scr and using the script command to open the linework have any merit? :-o

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #27 on: January 09, 2007, 01:18:48 PM »
DOH! I didn't notice that part of it.....Yes, that file will need to be renamed or the lisp needs to be modified to:
(if (setq ffile (open "c:\\plinex~1.txt" "R"))

No, the scr won't work (I think).

jbaxter

  • Guest
Re: R12 polylines
« Reply #28 on: January 09, 2007, 07:19:02 PM »
Hi Jeff,

I have the txt file residing in the root directory of drive c: however the (importplinestor12) keeps telling me that "file not found" ??? both filenames in the lisp code and file are identical.

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #29 on: January 09, 2007, 08:18:27 PM »
Can you manually rename the txt file to "plines.txt" and change the (importplinestor12) function to look for "plines.txt"?

Also, I just found my old R10 autolisp manual. I see that (open) requires the mode flag to be lowercase. It doesn't appear that there is a limit to the length of a function name...the GardenPath in the tutorial has a function consisting of 9 letters.

But, there was no (entmake) in R10....wow....