Author Topic: R12 polylines  (Read 7758 times)

0 Members and 2 Guests are viewing this topic.

jbaxter

  • Guest
R12 polylines
« on: September 18, 2006, 07:38:57 PM »
Greetings,

I want to produce a set of polyline contours in an old copy of R12c3 acad identical to that which I have in R2002.

I do not want to do a DXF transfer or saveasr12 because along with the file comes a buch of stuff that upsets a particular addon in r12 that I want to use.

Is there a way to extract with r2002 using say a script file to produce the contours and then use that script file within r12? I am thinking something that picks up on the vertex points of the countours, these are 2d polylines.

Regards,
John

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #1 on: September 18, 2006, 08:34:14 PM »
Here's a start for you. I've got to run, but this creates a file with the required entity list data that can be read into R12 to (entmake) the plines. I haven't yet tested the import part, but I think it should work rather easily....when reading each line from the file you will need to convert from the string to a list.....

Code: [Select]
removed in favor of code posted later on.....
« Last Edit: September 19, 2006, 06:20:24 PM by Jeff_M »

jbaxter

  • Guest
Re: R12 polylines
« Reply #2 on: September 19, 2006, 02:45:46 AM »
Thank you Jeff, I will give it a try and let you know.

Your help with this is much appreciated. I am attempting to take out the digitising process to get the lines into r12 when I already have them within 2002.

I will let you know how I go.

Regards,
John

jbaxter

  • Guest
Re: R12 polylines
« Reply #3 on: September 19, 2006, 02:49:08 AM »
Hi Jeff,

I am getting a syntax error as below:

regards,
JB



Command: appload
Export2r12.lsp successfully loaded.


Command:
Select objects: c

Specify first corner: Specify opposite corner: 181 found

Select objects:



extra right paren on input
Command:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: R12 polylines
« Reply #4 on: September 19, 2006, 03:56:28 AM »
John, Jeff's parenthesis match, have you checked that you copied the post intact ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #5 on: September 19, 2006, 11:12:01 AM »
Well, I knew I was in too much of a hurry last night. Although the code I posted does work with old-style plines (thanks for checking the parenthesis matching, Kerry) I forgot to include the code that converts LWPlines to 2d plines......I'll work on that and the import routine later on.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #6 on: September 19, 2006, 06:24:34 PM »
Here's the revised code that I tested with LWPlines and 2d plines. I can output from R2002 and import back into 2002. I do not have R12 installed to test it there, however. I do believe it will work, as I've stripped off any codes that I think were not available in R12.
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))))))
  (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))
    )
  (write-line (vl-prin1-to-string elist) ffile)
  (setq ent (entnext ent))
  )
(write-line (vl-prin1-to-string elist) ffile)
)
      (close ffile)
      (command "_undo" "_end")
      (command "u")
      )
    )
  )

(defun importplinestor12 (/ ffile line)
  (if (setq ffile (open "c:\\plinexport.txt" "R"))
    (progn
      (while (setq line (read-line ffile))
(entmake (read line))
)
      (close ffile)
      )
    )
  )

jbaxter

  • Guest
Re: R12 polylines
« Reply #7 on: September 19, 2006, 07:37:51 PM »
Thanks Jeff & Kerry, I will give it a whirl.

I have a terrain modelling suite of routines that was designed by a company that has long since gone belly up but the output mesh from it using r12 pure linework is sensational and have not seen anything to match it in todays software so want to keep using it. I have tried all kinds of dxf transfer and others, even taken dxf into ms-word and stripped out the first 17 pages of r2000 stuff and then other entries that are there although supposedly an r12 dxf file output.

My thinking here is that if I can get the r2002 contours into the r12 screen and they are what r12 would produce itself then the programs may work for me hopefully.

I will let you know.

Regards,
JB




Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #8 on: September 19, 2006, 07:43:20 PM »
Ya know, I thought that this sounded familiar. I was in on trying some other workarounds sometime ago. I don't think this was an approach we tried, though!

Good Luck, I'll cross my fingers for you!

BTW, could you share a drawing or data that this software creates? Have you compared it to what Civil3D outputs?

jbaxter

  • Guest
Re: R12 polylines
« Reply #9 on: September 19, 2006, 08:04:28 PM »
Hi,

Not sure what I am doing wrong here but the lisp loads as below but do not seem to be able to invoke it to select my contours.

I will upload a mesh of golf green for you. The software I have centres around creating meshes that remember the momentum of contours and rounds off tops of mounds and bottoms of pits like bunkers without extra work to add contours etc.,very handy but not user friendly:-)

Regards,
John

--------------------------------------------------------------------------------------------

Command: (LOAD "D:/Lisp/Exportplinestor12.lsp") IMPORTPLINESTOR12

Command: exportplinestor12
Unknown command "EXPORTPLINESTOR12".  Press F1 for help.

LE

  • Guest
Re: R12 polylines
« Reply #10 on: September 19, 2006, 10:45:44 PM »
Add a command like:

Code: [Select]
(defun C:XPOLS () (exportplinestor12) (princ)) (princ)

jbaxter

  • Guest
Re: R12 polylines
« Reply #11 on: September 20, 2006, 04:36:05 AM »
Hi Le,

I am not very lisp literate, where does this string get added to the code?

Regards,
John

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: R12 polylines
« Reply #12 on: September 20, 2006, 05:03:06 AM »
Hi Le,

I am not very lisp literate, where does this string get added to the code?

Regards,
John
Code: [Select]
(defun C:XPOLS () (exportplinestor12) (princ))
;;
(defun exportplinestor12 (/ ss idx ffile ent elist)
  (if (setq ss (ssget '((0 . "*POLYLINE"))))

;; ... >>>
;;
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

jbaxter

  • Guest
Re: R12 polylines
« Reply #13 on: September 20, 2006, 08:47:30 AM »
Thanks Kerry, I will add that line and give it a go.

Regards,
JB

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: R12 polylines
« Reply #14 on: September 20, 2006, 03:25:35 PM »
Thanks LE & KB for picking up my slack. John, in addition to what they said, you can invoke those functions direct like so:

Command: (exportplinestor12)
Command: (importplinestor12)