Jump to content

Recommended Posts

Posted

I have modified this code that Fixo wrote for me to create a yellow box road marking. The code stops at trying to set "hpscale". Can anyne help with this? Where is my mistake?

 

 
(defun C:yellow_box (/ *error* ang coords elist midp ofpt p1 p2 p3 pline SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
(setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))

(command "_.-layer" "_N" "CCC_LAYOUT_Proposed_Road_Lining_Yellow_Box" "_C" "2" "CCC_LAYOUT_Proposed_Road_Lining_Yellow_Box" "" )
(setvar "clayer" "CCC_LAYOUT_Proposed_Road_Lining_Yellow_Box")  
(command "._pline")
(while (= 1 (logand 1 (getvar "cmdactive")))
(command pause))
 (setq pline (entlast)
elist (entget pline)
)
(setq elist (entmod (subst (cons 70 1)(assoc 70 elist)elist)));<--close pline
(entmod (subst (cons 43 0)(assoc 43 elist)elist));<--set line width to zero
(setvar "draworderctl" 3)  
(command "_.draworder" pline "" "_F");<--set pline's draw order to front  
(setq coords (vl-remove-if (function not)
  (mapcar (function (lambda (x)
        (if (= 10 (car x))(cdr x))))
   elist))
)
(setq p3 (caddr coords)
     p1 (car coords)
     ang (angle p1 p3)
     ofpt (polar p3 ang 1.0)
     )

(command "._pedit" pline "_W" 0.15 "")
(setq coords (vl-remove-if (function not)
  (mapcar (function (lambda (x)
        (if (= 10 (car x))(cdr x))))
   elist))
)
 (setq p2 (car coords)
midp (mapcar (function (lambda( a b)(/ (+ a b) 2)))
      p1 p2)
)
 (setvar "hpname" "ANSI37")
 (setvar "hpscale" "2")
 (command "-hatch" "S" pline "" "")
 ;(while (> (getvar "cmdactive") 0)
   ;(command "\\") ;<- The Pause symbol will not pause the command. Backslash used instead. 
 
 (setvar "hpname" ".")
 
 (setvar "cmdecho"   SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode"    SUSM)
 (setvar "angbase"   SUAB)
 (setvar "angdir"    SUAD)
 (setvar "clayer"    SUCL)
 (setvar "cecolor"    SUCR)
(princ) 
)

Posted

No worries. I just got it. It was the " " around the 2.

 

Thanks anyway.

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