Author Topic: Area reactor  (Read 33935 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #60 on: June 16, 2006, 07:18:27 PM »
Try this when you get a chance.

Code: [Select]
; DDlabelArea.lsp

(defun c:ddla (/ area1 area2 tab oba inspoint objarea)

(setq areanamelist(list
""
"Verblijfsgebied A"
"Verblijfsgebied B"
"Verblijfsgebied C"
"Verblijfsgebied D"
"Verblijfsgebied E"
"Verblijfsgebied F"
"Verblijfsgebied G"
"Verkeersgebied"
"Onbenoemde Ruimte"
"Badkamer"
"Toilet"
))

(setq rotationlist(list
"0"
"45"
"90"
"135"
"180"
"225"
))

; ************************************************
  (defun txtbox_infohulp ()
    (alert
      (strcat
        "DDLabelArea 2006 Help.\n\n"
        "Please report any problems you may have.\n\n"
       )
    )
  )
; ************************************************

(setq DDLA (load_dialog "DDlabelarea"))
(new_dialog "DDlabelarea" DDLA)
(start_list "areanamelist")
(mapcar 'add_list areanamelist)
(end_list)

(start_list "rotationlist")
(mapcar 'add_list rotationlist)
(end_list)

; ************************************************
(defun do_hatch ()
  (if (=  (get_tile "do-hatch") "1")(setq hatch-area "J"))
  (if (/= (get_tile "do-hatch") "1")(setq hatch-area "N"))
)
; ************************************************

(action_tile "accept" "(setq area-name (get_tile \"areanamelist\"))(setq rotation (get_tile \"rotationlist\"))(done_dialog 1)")
(action_tile "do-hatch" "(do_hatch)")
(action_tile "hulp" "(txtbox_infohulp)")
(action_tile "cancel" "(exit)(exit)")
(setq RET (start_dialog))

  (setvar "cmdecho" 1)
  (setq fd (getvar "fielddisplay"))
  (if (/= fd 1)(setvar"fielddisplay" 1))


;;(setq area1 (entsel "\nSelect Area Boundary: "))
(while (not (setq ss (ssget ":e:s" '((0 . "LWPOLYLINE") (70 . 1))))))
(setq area1 (ssname ss 0))

(setq area2 area1)
(setq tab (vlax-ename->vla-object area2))
(setq oba (vla-get-objectid tab))


(princ)
(setq inspoint (getpoint "\nPick label insertion point:  "))
(princ)
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, m2]%ds44%ct8[1e-006]\">%"))
(setvar "attdia" 0)
(setvar "attreq" 1)
(setq schaal (rtos(getvar "userr1")))
(command "-insert" "oppervlakte" "s" schaal inspoint (nth (atoi rotation) rotationlist) (nth (atoi area-name) areanamelist) objarea )
;(command "-insert" "det-bub" "s" schaal inspoint (nth (atoi rotation) rotationlist) (nth (atoi area-name) areanamelist) objarea )

(setq hatchobjects(entlast))

(command "-layer" "n" "00---0-a_Arceer" "")
(setq area-name (nth (atoi area-name) areanamelist))

  (cond
((= area-name "Verblijfsgebied A")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied B")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Toilet")           (setq anghatch "135")(setq dblhatch "n"))
((= area-name "Verkeersgebied")   (setq anghatch "45") (setq dblhatch "y"))
)
(print anghatch)
(print dblhatch)

  (if (= hatch-area "J")(command "-bhatch" "s" area1 hatchobjects "" "p" "u" anghatch "150" dblhatch ""))


(setq hatch-area nil )
(setq hatchobjects nil )
(setq anghatch nil )
(setq dblhatch nil)
(command "-layer" "s" "0" "")
 
(setvar "attdia" 1)
(setvar "attreq" 1)
  (princ)
)

One thing I would do is get all the information from the dialog box once you exit the dialog box, so that you only have one action tile.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #61 on: June 19, 2006, 03:40:54 AM »
Tim i tried your code and still no luck..Same problem variables not set.Same goes for the added precision.

It is set with this
Code: [Select]
(setq area-name (nth (atoi area-name) areanamelist)) before the cond and it will print the name on the command line but then it will not be inserted in the block.

This is what i got sofar and  still  cant figure out what is wrong.


Code: [Select]

(defun c:DDLabelArea (/ area1 area2 tab oba inspoint objarea)

(setq areanamelist(list
""
"Badkamer"
"Onbenoemde Ruimte"
"Toilet"
"Verblijfsgebied A"
"Verblijfsgebied B"
"Verblijfsgebied C"
"Verblijfsgebied D"
"Verblijfsgebied E"
"Verblijfsgebied F"
"Verblijfsgebied G"
"Verblijfsgebied H"
"Verblijfsgebied I"
"Verblijfsgebied J"
"Verkeersgebied"
))

(setq rotationlist(list "0" "45" "90" "135" "180" "225" "270" "315"))

(setq precisionlist (list "0" "0.0" "0.00" "0.000" "0.0000" "0.00000" "0.000000" "0.0000000" "0.00000000"))

  ; ************************************************
  (defun txtbox_infohulp ()
    (alert
      (strcat
        "DDLabelArea 2006 Help.\n\n"
        "Klik op OK om dit venster te sluiten.\n\n"
        "Please report any problems you may have.\n\n"
       )
    )
  )
; ************************************************

(setq DDLA (load_dialog "DDlabelarea"))
(new_dialog "DDlabelarea" DDLA)

(start_list "areanamelist")
(mapcar 'add_list areanamelist)
(end_list)

(start_list "rotationlist")
(mapcar 'add_list rotationlist)
(end_list)

(start_list "precisionlist")
(mapcar 'add_list precisionlist)
(end_list) 

 
; ************************************************
(defun do_hatch ()
  (if (=  (get_tile "do-hatch") "1")(setq hatch-area "J"))
  (if (/= (get_tile "do-hatch") "1")(setq hatch-area "N"))
)
; ************************************************

(set_tile "precisionlist" "2")
(action_tile "accept" "(setq area-name (get_tile \"areanamelist\"))(setq rotation (get_tile \"rotationlist\"))(setq precision (get_tile \"precisionlist\"))(setq suffix (get_tile \"suffixlist\"))(done_dialog 1)")
(action_tile "do-hatch" "(do_hatch)")
(action_tile "hulp" "(txtbox_infohulp)")
(action_tile "cancel" "(exit)(exit)")
(setq RET (start_dialog))}

(setvar "cmdecho" 1)
(setq fd (getvar "fielddisplay"))
(if (/= fd 1)(setvar"fielddisplay" 1))

(prompt "\nSelect Area Boundary (This must be an Closed Polyline): ")
(while (not (setq ss (ssget ":e:s" '((0 . "LWPOLYLINE") (70 . 1)))))
(prompt "\nSelected object is NOT an Closed LWPolyline.... "))
(setq area1 (ssname ss 0))
(setq area2 area1)
(setq tab (vlax-ename->vla-object area2))
(setq oba (vla-get-objectid tab))

(princ)
(setq inspoint (getpoint "\nPick label insertion point:"))
(princ)
(setq area-name (nth (atoi area-name) areanamelist))


(cond
(
(and (= suffix "suffix1")(= precision "0")         (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.0")       (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.00")      (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.000")     (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.0000")    (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.00000")   (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.000000")  (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.0000000") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps[, m2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix1")(= precision "0.00000000")(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps[, m2]%ds44%ct8[1e-006]\">%"))))


(
(and (= suffix "suffix2")(= precision "0")         (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.0")       (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.00")      (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.000")     (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.0000")    (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.00000")   (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.000000")  (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.0000000") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps[, M2]%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix2")(= precision "0.00000000")(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps[, M2]%ds44%ct8[1e-006]\">%"))))


(
(and (= suffix "suffix3")(= precision "0")         (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.0")       (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.00")      (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.000")     (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.0000")    (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.00000")   (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.000000")  (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.0000000") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps%ds44%ct8[1e-006]\">%"))))
(
(and (= suffix "suffix3")(= precision "0.00000000")(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps%ds44%ct8[1e-006]\">%"))))


;((= suffix "suffix1") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps[, m2]%ds44%ct8[1e-006]\">%")))
;((= suffix "suffix2") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, M2]%ds44%ct8[1e-006]\">%")))
;((= suffix "suffix3") (setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps%ds44%ct8[1e-006]\">%")))
((= area-name "Badkamer")         (setq anghatch "135")(setq dblhatch "n"))
((= area-name "Toilet")           (setq anghatch "135")(setq dblhatch "n"))
((= area-name "Verblijfsgebied A")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied B")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied C")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied D")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied E")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied F")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied G")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied H")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied I")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied J")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verkeersgebied")   (setq anghatch "45") (setq dblhatch "y"))
)

(setvar "attdia" 0)
(setvar "attreq" 1)
(setq schaal (rtos(getvar "userr1")))
(command "-insert" "oppervlakte" "s" schaal inspoint (nth (atoi rotation) rotationlist) (nth (atoi area-name) areanamelist) objarea )

(setq hatchobjects(entlast))
(command "-layer" "s" "00---0-a_Arceer" "")


(print anghatch)
(print dblhatch)

(setq area-name (nth (atoi area-name) areanamelist)) 
;;(if (= hatch-area "J")(command "-bhatch" "s" area1 hatchobjects "" "p" "u" "45" "150" "n" ""))

(if (= hatch-area "J")(command "-bhatch" "s" area1 hatchobjects "" "p" "u" anghatch "150" dblhatch ""))


(setq hatch-area nil )
(setq hatchobjects nil )
(setq suffix nil )
(setq anghatch nil )
(setq dblhatch nil)
(command "-layer" "s" "0" "")
 
(setvar "attdia" 1)
(setvar "attreq" 1)
(princ)
)



Code: [Select]
DDlabelarea : dialog {value = "DDLabelArea 2006";
:row{
:boxed_row  {label = "< Select Area Name >";
:popup_list {key = "areanamelist"; width = 25;}}
:boxed_row  {label = "< Precision >";
:popup_list {key = "precisionlist";width = 1;}}
}

:spacer{height=1;}

:boxed_radio_row{label="< Suffix >";key="suffixlist";
:radio_button {label="m2"   ;key="suffix1" ;mnemonic = "2";value = "1";}
:radio_button {label="M2"   ;key="suffix2" ;mnemonic = "M";}
:radio_button {label="None" ;key="suffix3" ;mnemonic = "N";}
}

:spacer{height=1;}

:row{
:boxed_row  {label = "< Rotation >";
:popup_list {key = "rotationlist"  ; width = 1; }}
:boxed_row {label = "< Hatch > "  ;

:spacer{height=1;}

:toggle {label = "Yes"; key = "do-hatch";mnemonic = "Y";}}}

:row{
:button {label="Sel. Object";width   =10;height = 1.4;key="accept";mnemonic = "S";}
:button {label="Help"       ;width   =10;height = 1.4;key="hulp"  ;mnemonic = "H";}
:spacer {height=5;}

cancel_button;
}
}
« Last Edit: June 19, 2006, 04:28:19 AM by MvdP »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #62 on: June 19, 2006, 12:20:10 PM »
Please study this, as it works.

Code: [Select]
(defun c:DDLabelArea (/ areanamelist rotationlist precisionlist ddla area-name rotation precision suffix
                        fd ss area1 area2 tab oba ret inspoint objarea anghatch dblhatch schaal hatchobject)

(setq areanamelist(list
""
"Badkamer"
"Onbenoemde Ruimte"
"Toilet"
"Verblijfsgebied A"
"Verblijfsgebied B"
"Verblijfsgebied C"
"Verblijfsgebied D"
"Verblijfsgebied E"
"Verblijfsgebied F"
"Verblijfsgebied G"
"Verblijfsgebied H"
"Verblijfsgebied I"
"Verblijfsgebied J"
"Verkeersgebied"
))

(setq rotationlist(list "0" "45" "90" "135" "180" "225" "270" "315"))

(setq precisionlist (list "0" "0.0" "0.00" "0.000" "0.0000" "0.00000" "0.000000" "0.0000000" "0.00000000"))

  ; ************************************************
  (defun txtbox_infohulp ()
    (alert
      (strcat
        "DDLabelArea 2006 Help.\n\n"
        "Klik op OK om dit venster te sluiten.\n\n"
        "Please report any problems you may have.\n\n"
       )
    )
  )
; ************************************************

(setq DDLA (load_dialog "DDlabelarea"))
(new_dialog "DDlabelarea" DDLA)

(start_list "areanamelist")
(mapcar 'add_list areanamelist)
(end_list)

(start_list "rotationlist")
(mapcar 'add_list rotationlist)
(end_list)

(start_list "precisionlist")
(mapcar 'add_list precisionlist)
(end_list)

 
; ************************************************
(defun do_hatch ()
  (if (=  (get_tile "do-hatch") "1")(setq hatch-area "J"))
  (if (/= (get_tile "do-hatch") "1")(setq hatch-area "N"))
)
; ************************************************

(set_tile "precisionlist" "2")
(action_tile "accept" "(setq area-name (get_tile \"areanamelist\"))(setq rotation (get_tile \"rotationlist\"))(setq precision (get_tile \"precisionlist\"))(setq suffix (get_tile \"suffixlist\"))(done_dialog 1)")
(action_tile "do-hatch" "(do_hatch)")
(action_tile "hulp" "(txtbox_infohulp)")
(action_tile "cancel" "(exit)(exit)")
(setq RET (start_dialog))}

(setvar "cmdecho" 1)
(setq fd (getvar "fielddisplay"))
(if (/= fd 1)(setvar"fielddisplay" 1))

(prompt "\nSelect Area Boundary (This must be an Closed Polyline): ")
(while (not (setq ss (ssget ":e:s" '((0 . "LWPOLYLINE") (70 . 1)))))
(prompt "\nSelected object is NOT an Closed LWPolyline.... "))
(setq area1 (ssname ss 0))
(setq area2 area1)
(setq tab (vlax-ename->vla-object area2))
(setq oba (vla-get-objectid tab))

(princ)
(setq inspoint (getpoint "\nPick label insertion point:"))
(princ)
(setq area-name (nth (atoi area-name) areanamelist))
(setq rotation (nth (atoi rotation) rotationlist))
(setq precision (nth (atoi precision) precisionlist))


(cond
(
(and (= suffix "suffix1")(= precision "0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.00"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.0000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.00000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.0000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix1")(= precision "0.00000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps[, m2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.00"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.0000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.00000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.0000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix2")(= precision "0.00000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps[, M2]%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr0%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.0"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr1%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.00"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr2%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr3%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.0000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr4%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.00000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr5%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr6%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.0000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr7%ps%ds44%ct8[1e-006]\">%"))
)
(
(and (= suffix "suffix3")(= precision "0.00000000"))
(setq objarea (strcat "%<\\AcObjProp Object(%<\\_ObjId " (rtos oba 2 0) ">%).Area \\f \"%lu2%pr8%ps%ds44%ct8[1e-006]\">%"))
)
)
(cond
((= area-name "Badkamer")         (setq anghatch "135")(setq dblhatch "n"))
((= area-name "Toilet")           (setq anghatch "135")(setq dblhatch "n"))
((= area-name "Verblijfsgebied A")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied B")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied C")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied D")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied E")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied F")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied G")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied H")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied I")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verblijfsgebied J")(setq anghatch "45") (setq dblhatch "n"))
((= area-name "Verkeersgebied")   (setq anghatch "45") (setq dblhatch "y"))
)

(setvar "attdia" 0)
(setvar "attreq" 1)
(setq schaal
 (rtos
  (if (equal (getvar "userr1") 0.0)
   1.0
   (getvar "userr1")
  )
 )
)
(command "-insert" "oppervlakte" "s" schaal inspoint (nth (atoi rotation) rotationlist) (nth (atoi area-name) areanamelist) objarea )
;(command "-insert" "det-bub" "s" schaal inspoint (nth (atoi rotation) rotationlist) (nth (atoi area-name) areanamelist) objarea )
(setq hatchobjects(entlast))
(command "-layer" "n" "00---0-a_Arceer" "")


(print (nth (atoi area-name) areanamelist))
(print objarea)

(setq area-name (nth (atoi area-name) areanamelist))
;;(if (= hatch-area "J")(command "-bhatch" "s" area1 hatchobjects "" "p" "u" "45" "150" "n" ""))

(if (= hatch-area "J")(command "-bhatch" "s" area1 hatchobjects "" "p" "u" anghatch "150" dblhatch ""))


(setq hatch-area nil )
(setq hatchobjects nil )
(setq suffix nil )
(setq anghatch nil )
(setq dblhatch nil)
(command "-layer" "s" "0" "")
 
(setvar "attdia" 1)
(setvar "attreq" 1)
(princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #63 on: June 20, 2006, 02:09:24 AM »
Thanks Tim

First of all i want to thank you for the tremendous amount of time and patience.
I studied your code and off course tried it and these are my findings.It is not entirely working but getting there.

The area-name is not inserted in the block and when changing the insertion angle it is not working.(Block not inserted)

But changing this:

Code: [Select]
princ)
(setq inspoint (getpoint "\nPick label insertion point:"))
(princ)
(setq area-name (nth (atoi area-name) areanamelist))
(setq rotation (nth (atoi rotation) rotationlist))
(setq precision (nth (atoi precision) precisionlist))

In to this:

Code: [Select]
(princ)
(setq inspoint (getpoint "\nPick label insertion point:"))
(princ)
;;(setq area-name (nth (atoi area-name) areanamelist))
;;(setq rotation (nth (atoi rotation) rotationlist))
(setq precision (nth (atoi precision) precisionlist))

The area-name is inserted but then the area is not hatched.Because variable anghatch and dblhatch are not set.!!!


Modified after getting an idea.....Tried changing variable area-name into areaname (see piece of code below)


Code: [Select]
(princ)
(setq inspoint (getpoint "\nPick label insertion point:"))
(princ)
(setq areaname (nth (atoi area-name) areanamelist))
;;(setq rotation (nth (atoi rotation) rotationlist))
(setq precision (nth (atoi precision) precisionlist))

And also changed this:
Code: [Select]
(cond
((= areaname "Badkamer")         (setq anghatch "135")(setq dblhatch "n"))
((= areaname "Toilet")           (setq anghatch "135")(setq dblhatch "n"))
((= areaname "Verblijfsgebied A")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied B")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied C")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied D")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied E")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied F")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied G")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied H")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied I")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verblijfsgebied J")(setq anghatch "45") (setq dblhatch "n"))
((= areaname "Verkeersgebied")   (setq anghatch "45") (setq dblhatch "y"))
)
And sofar i got it finally working the way i want it.
So once again Tim thank you  for helping me with this.It has been a lot of fun.....




« Last Edit: June 20, 2006, 03:28:41 AM by MvdP »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #64 on: June 20, 2006, 03:18:27 AM »
Okay.  Attach a lisp file, dcl file and a drawing that I can test it on when I get to work tomorrow.  It worked on my computer at work, so let me try the one you are using, and can go from there.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #65 on: June 20, 2006, 05:02:13 AM »
Here are the files you requested.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #66 on: June 20, 2006, 11:26:41 AM »
It worked just fine for me.  All I had to do was change the value of "userr1", as the 20 scaled the block to much.  Once I changed that to one, it inserted the block the way it looked when you attached it.

Is it not supposed to look that way?  I don't know (most likey don't have the program) to make a video, or I would to show you that it works.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #67 on: June 20, 2006, 11:31:06 AM »
Tim  it is working for me also and the way i want it work.I think you missed the last part of my previous post.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #68 on: June 20, 2006, 11:48:56 AM »
Tim  it is working for me also and the way i want it work.I think you missed the last part of my previous post.
Yup I did.  I'm glad you got it working the way you want it to, and I hope you learned a lot from this experience also.  Have fun. :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #69 on: June 20, 2006, 12:04:33 PM »
I learned an awful lot and maybe i can learn one thing more.When you hit the escape button it isn't looking very nice.
Is there a way to make it nicer.?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #70 on: June 20, 2006, 12:22:30 PM »
You will have to code your cancel button in your dcl file better.  Here is what one of mine looks like.
Code: [Select]
: button { label = "Cancel"; key = "cancel"; is_cancel = true; }
What you want is the "is_cancel" area.  AFAIK, this is telling the program that if escape is hit, then use the button that is labeled "is_cancel = true".  Plus in your code, you have when cancel is hit to exit.  I would set it up so that "Select Polyline" is (done_dialog 1) and the cancel button is (done_dialog 0), and then check the (start_dialog) and if it equals 1 then proceed with the lisp, but if not then just exit.  Example
Code: [Select]
(if (equal (start_dialog) 1)
 (progn
  ....... do your code here ...
 )
 (prompt "\n Function canceled.")
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #71 on: June 20, 2006, 01:23:36 PM »
I can 't try it now but this is what i created.
 
Code: [Select]
DDlabelarea : dialog {value = "DDLabelArea 2006";

:row{
:boxed_row  {label = "< Select Area Name >";
:popup_list {key = "areanamelist"; width = 25;}}
:boxed_row  {label = "< Precision >";
:popup_list {key = "precisionlist";width = 1;}}
}

:spacer{height=1;}

:boxed_radio_row{label="< Suffix >";key="suffixlist";
:radio_button {label="m2"   ;key="suffix1" ;mnemonic = "2";value = "1";}
:radio_button {label="M2"   ;key="suffix2" ;mnemonic = "M";}
:radio_button {label="None" ;key="suffix3" ;mnemonic = "N";}
}

:spacer{height=1;}

:row{
:boxed_row  {label = "< Rotation >";
:popup_list {key = "rotationlist"  ; width = 1; }}
:boxed_row {label = "< Hatch > "  ;

:spacer{height=1;}

:toggle {label = "Yes"; key = "do-hatch";mnemonic = "Y";}}}

:row{
:button {label="Sel. Object";width   =10;height = 1.4;key="accept";mnemonic = "S";}
:button {label="Help"       ;width   =10;height = 1.4;key="hulp"  ;mnemonic = "H";}
:button {label="Cancel"     ;width   =10;height = 1.4;key="cancel"; is_cancel = true;mnemonic = "C"; }
:spacer {height=5;}

}
}


The DCL is the easy part but now the (very) hard part.This what i changed.

Code: [Select]
(if (equal (start_dialog) 1)
(progn
(set_tile "precisionlist" "2")
(action_tile "accept" "(setq area-name (get_tile \"areanamelist\"))(setq rotation (get_tile \"rotationlist\"))(setq precision (get_tile \"precisionlist\"))(setq suffix (get_tile \"suffixlist\"))(done_dialog 1)")
(action_tile "do-hatch" "(do_hatch)")
(action_tile "hulp" "(txtbox_infohulp)")
)
(action_tile "cancel" "(done_dialog 0)")(prompt "\n Function canceled.")
(setq RET (start_dialog))
« Last Edit: June 20, 2006, 01:26:41 PM by MvdP »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #72 on: June 20, 2006, 01:40:18 PM »
Here is how you should change the lisp portion.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MvdP

  • Guest
Re: Area reactor
« Reply #73 on: June 21, 2006, 01:39:40 AM »
Thanks again Tim.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Area reactor
« Reply #74 on: June 21, 2006, 11:08:46 AM »
Thanks again Tim.
You're welcome [insert real name here].  :roll:
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.