Author Topic: PlotStyle  (Read 6238 times)

0 Members and 1 Guest are viewing this topic.

youainta

  • Mosquito
  • Posts: 2
PlotStyle
« on: November 12, 2021, 11:58:44 PM »
I've come to understand that a lisp routine is basically a puzzle made up of puzzle pieces. Groups of code are the puzzle pieces and a functioning lisp routine, the puzzle. That being said, I haven't been able to figure out plotstyle. Using entmake to create a layer tells me that the 390 dxf code for plotstyle is a hard pointer to id handle, which doesn't sound like can be set.

I've tried to follow this post http://www.theswamp.org/index.php?topic=45131.msg503425#msg503425 as well as I can.

My question is how can I assign a plotstyle to a layer I'm creating? And how does that tie in to entmake?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: PlotStyle
« Reply #1 on: November 13, 2021, 07:06:52 AM »
For an existing example, you may wish to refer to lines 497-503 of my Layer Director application - essentially, you need to point DXF group 390 to the appropriate entry within the acad_plotstylename dictionary.

youainta

  • Mosquito
  • Posts: 2
Re: PlotStyle
« Reply #2 on: November 17, 2021, 01:39:38 PM »
What does too few arguments mean?

This is what I've put together:

Code: [Select]
(setq linelist '(("Cable Television" . "utilities.lin")
("Electrical" . "utilities.lin")
("Fiber Optics" . "utilities.lin")
("Fire_Line" . "utilities.lin")
("Gas_line" . "utilities.lin")
("Sewer_Line" . "utilities.lin")
("Storm Sewer" . "utilities.lin")
("Telephone" . "utilities.lin")
("OHE" . "utilities.lin")
("UGE" . "utilities.lin")
("Water" . "utilities.lin")
)
)
(foreach lin linelist
  (if (tblsearch "LTYPE" (car lin))
    (command ".-linetype" "load" (car lin) (cdr lin) "_Yes" "")
    (command ".-linetype" "load" (car lin) (cdr lin) "")
  )
)

(defun _layer (name plot color linetype lineweight plotstyle)
  (if (null (tblsearch "LAYER" name))
    (entmake
      (list
'(000 . "LAYER")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLayerTableRecord")
'(070 . 0)
(cons 002 name)
(cons 290 plot)
(cons 062 color)
(cons 006 linetype)
(cons 370 lineweight)
(cons 390 plotstyle)
  (if
    (and (= 'str (type pst))
(zerop (getvar 'pstylemode))
(setq
   dic (dictsearch (namedobjdict) "acad_plotstylename"))
(setq dic (dictsearch (cdr (assoc -1 dic)) pst))
    )
  )
)
      )
    )
  )

       

(defun c:test ( / )
 (foreach _layer
  '(
    ("newlay" 1 12 "Continuous" 100 "100-10")
   )
   (apply '_layer item)
 )
 (princ)
)

Note: Credit to whom credit is due.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: PlotStyle
« Reply #3 on: November 17, 2021, 04:43:33 PM »
  • You forgot to rename the pst variable when you copy/pasted my code.
  • Your if statement doesn't have a 'then' argument, but only a test expression - this is what is causing the error you have observed.
  • (foreach _layer should be (foreach item