Author Topic: Attribute Prompt Missing?  (Read 5831 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« on: November 17, 2004, 11:08:10 AM »
I am using the following code to conditionally edit attributes of an inserted block.
The problem I have is that the code 3 prompt string is not in the entlist but
if i issue a attedit at the command line the prompts are there.
Why are they not in the entlist?

Code: [Select]
;**ATTRIB**
 ;
 ;This function controls attribute input based on the system variable
 ;"USERI2" being set to "0" or "1" for off and on.
 ;
(defun attrib (blk_nam new_txt layer blk_scale
               / last_pt entl prmpt defval temp ss)
  (princ " *Start attrib* ")
  (if atrbute
    (progn
      (cond
        ((equal 0 (getvar "USERI2"))
         (command "UNDO" "_BEGIN")
         (prompt "Gathering data. Please Wait....")
         (setq temp modelist)
         (savemode '("regenmode" "expert"))
         (setq modelist (append temp modelist))
         (setvar "regenmode" 0)
         (setvar "expert" 1)
         (setq last_pt (getvar "lastpoint"))
         (setq temp nil
               ss   (ssadd)
         )
         (if (not (null layer))
           (set-lay layer)
         )
         ;;  insert attributed block & explode it
         (setq blk_scale (* (getvar "USERR3") blk_scale)) ; get scale
         (command "insert" blk_nam last_pt 10 10 0) ; temp test CAB - SCALE

         (setq comnd t)
         (terpri)
         ;;  step through exploded items
         (setq ent (entlast)
               ins ent
         )
         ;;-----------------------------------------------------------------
         (while (and ent
                     (/= "SEQEND" (op_dxf 0 (setq entl (entget ent))))
                )
           (cond
             ;;  process attribute items only
             ((= (op_dxf 0 entl) "ATTRIB")
              ;;  see if TAG Str matches anything in new_txt
              (setq attr (cadr (assoc (op_dxf 2 entl) new_txt)))
              (cond
                ((null attr) ; no match in new_txt
;;VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
;;   Problem here, no code 3 in entl   ????????????????????????????
                 (setq prmpt (op_dxf 3 entl)) ; get Prompt Str from attribute
;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 (cond
                   ;;  Str has menu code in it
                   ((equal "[" (substr prmpt 1 1))
 ;(menucmd (strcat "S=" (substr prmpt 2 8))); disabled CAB ???
                    (setq prmpt (substr prmpt 11))
                   )
                 )
                 (setq defval (op_dxf 1 entl)) ; get the default value from attrib
                 (princ)
                 ;; get update from user
                 (setq attr (getstring t (strcat "\n" prmpt " <" defval ">: ")))
                ) ; end cond (null attr)
              ) ; end cond stmt


              (cond
                ;;  do nothing if empty str or match default
                ((or (equal attr "")
                     (equal attr defval)
                 )
                ) ; end cond
                (t
                 ;;  replace with user entry
                 (entmod (subst (cons 1 attr) (assoc 1 entl) entl))
                 (entupd ins)
                ) ; end cond t
              ) ; end cond stmt
             ) ; end cond  equal attrib
           ) ; end cond stmt
           (setq ent (entnext ent))
         ) ; end while
         ;;----------------------------------------------------------------
         (rest-lay)
 ;(menucmd "S=S") ; back to last menu
         (setq comnd nil)
         (restmode)
         (command "move" "l" "" last_pt) ;"drag")  - CAB debug
        )
      )
    )
    (setq atrbute t)
  )
  (princ " *End attrib* ")
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

David Bethel

  • Swamp Rat
  • Posts: 656
Attribute Prompt Missing?
« Reply #1 on: November 17, 2004, 11:37:14 AM »
CAB

DXF group 3 is part of the ATTDEF in the block table and is not part of the INSERT ATTRIBs.

Yuo must modify the BLOCK table if you wish to change the prompt.  HTH  -David
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #2 on: November 17, 2004, 11:55:19 AM »
Thanks David,
I did not want to change the prompt, but to display the prompt while
changing the attribute in the insert.

The code loops through the attributes in the insert and prompts the user
for a new value. I could simultaneously loop through the block definition
or could have a subroutine to look up a block attribute given it's tag.
What approach have you used?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

David Bethel

  • Swamp Rat
  • Posts: 656
Attribute Prompt Missing?
« Reply #3 on: November 17, 2004, 01:43:20 PM »
I would step thru the block difinition and match tagnames with att prompts.  There is always the possiblity that someone has edited, deleted, or added ATTRIBs to the INSERT, so error checking would be advisable for this 1.  -David
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #4 on: November 17, 2004, 01:47:01 PM »
This is what I came up with.
Code: [Select]
;;  given a block name & tag, returns the prompt string
;;  or tag if prompt = ""
;;  returns nil if no block
(defun get_prompt (blknm tag / prmpt ent entl)
  (and
    (setq ent (op_dxf -2 (tblsearch "Block" blknm)))
    (setq entl (entget ent))
    (while (and ent
                (null prmpt)
                (/= "SEQEND" (op_dxf 0 (setq entl (entget ent))))
           )
      (if (and (= (op_dxf 0 entl) "ATTDEF")
               (= (op_dxf 2 entl) tag)
          )
        (setq prmpt (op_dxf 3 entl)
              prmpt (cond ((= prmpt "") tag) (prmpt))
        )
        (setq ent (entnext ent))
      )
    )
  )
  prmpt
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #5 on: November 17, 2004, 01:56:19 PM »
Say David is there a way to run ACAD 11 with windows 2000?

I tried to run in a DOS window and get this:
Par Lap err 35: The 386 chip is currently executing in vertual 8086 mode under the control of another
program. You must turm off the other program in order to use 386|DOS-Extender to run in protected mode.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

David Bethel

  • Swamp Rat
  • Posts: 656
Attribute Prompt Missing?
« Reply #6 on: November 17, 2004, 02:53:26 PM »
CAB,

 I'm running 98SE and R12.

I didn't think R11 would run even under 98SE.  It was memory nightmare.

In system.ini, you have to have:

Code: [Select]
[386Enh]
device=pharlap.386


Of coarse pharlap.386 must be in the windows search path ( /system folder )

-David
R12 Dos - A2K

David Bethel

  • Swamp Rat
  • Posts: 656
Attribute Prompt Missing?
« Reply #7 on: November 17, 2004, 03:02:51 PM »
As to the tagname prompt, here's how I would go about it:

Code: [Select]
(defun tagpmt (b / tdef fe tmp)
  (setq tdef (tblsearch "BLOCK" b)
          fe (cdr (assoc -2 tdef)))
  (while fe
     (setq ed (entget fe))
     (if (= "ATTDEF" (cdr (assoc 0 ed)))
         (setq tmp (cons (cons (cdr (assoc 2 ed)) (cdr (assoc 3 ed))) tmp)))
     (setq fe (entnext fe)))
tmp)


This would make a dotted pair list of tagname and prompt

Code: [Select]

(setq bn "TEMP1")
(setq tl (tagpmt bn))

(("TAGNAME1" . "PROMPT1")("TAGNAME2" . "PROMPT2"))

(cdr (assoc "tagname1" tl))



-David
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #8 on: November 17, 2004, 03:31:30 PM »
Thanks David,
Another question if I may.
The door tag has some 17 attributes. I was going to just send the routine
to the 'attedit' dialog box because there are too many for the command prompt.
Do you think that is a good idea? Options are to build a screen menu with the
prompts or to create a dialog box, which is what the attedit is.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Attribute Prompt Missing?
« Reply #9 on: November 17, 2004, 03:50:12 PM »
TheSwamp.org  (serving the CAD community since 2003)

t-bear

  • Guest
Attribute Prompt Missing?
« Reply #10 on: November 17, 2004, 03:59:36 PM »
That's nice Mark, but "for some strange reason" I can't seem to get my ACAD R2.7 to run in XP Pro ... any thoughts?


(Upgrade is out of the question, I'm just too durned cheap!)  LOL

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #11 on: November 17, 2004, 04:02:46 PM »
Hay Mark,
Thanks, but after looking at that I'm just going to get his old machine to
test on. I don't have the time, energy or experance to monkey with My system.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #12 on: November 17, 2004, 04:06:13 PM »
Funny t  :)

In fact I have seen referances in this lisp I am upgrading to ACAD 2.6.


Looking at your drawing last week, I think you are doing a good job.
You have a monster of a project there. :shock:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

David Bethel

  • Swamp Rat
  • Posts: 656
Attribute Prompt Missing?
« Reply #13 on: November 17, 2004, 04:22:04 PM »
CAB,

I must admit that I am a bit lost as to what exactly your program does.

A conditional ATTRIB edit to me would be editing only certain ATTRIBs on selected or filtered INSERTs?

-David
R12 Dos - A2K

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Attribute Prompt Missing?
« Reply #14 on: November 17, 2004, 04:46:25 PM »
Quote from: CAB
Say David is there a way to run ACAD 11 with windows 2000?

I tried to run in a DOS window and get this:
Par Lap err 35: The 386 chip is currently executing in vertual 8086 mode under the control of another
program. You must turm off the other program in order to use 386|DOS-Extender to run in protected mode.


Cab, I am not sure that it is possible. While the Pharlap 386 Extender would work on R12, it would only work on R12c3. It would not work with R12c2 or prior unpatched versions.

You are on the right track for R12 though..

system.ini
Code: [Select]

[386Enh]
device=pharlap.386


Copy the pharlap.386 executable to the system folder, leaving the one in the AutoCAD folder.

To my knowledge it is not possible with the older versions, but XP might offer some joy with compatability mode.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Attribute Prompt Missing?
« Reply #15 on: November 17, 2004, 05:20:21 PM »
Quote from: David D Bethel
CAB,

I must admit that I am a bit lost as to what exactly your program does.

A conditional ATTRIB edit to me would be editing only certain ATTRIBs on selected or filtered INSERTs?

-David


This is passed to the routine
(("DWIDTH" "3'-0\"")) as New_Txt

This line matched that and attr is not nil
(setq attr (cadr (assoc (op_dxf 2 entl) new_txt)))

so the edit attribute is skipped and flow falls directly to the entmod

This way the user doesn't have access to change the door width but is prompted
to change everything else.

This line
Code: [Select]
(menucmd (strcat "S=" (substr prmpt 2 8)))
would activate a menu of choices so the user can pick or enter the matching data.
This is the actual prompt string:  [AUD01MAS]Enter Door Width
It's actually pretty neat that you can pick from the Screen Menu instead of entering
from the command line. But 17 prompts for each door is a bit much.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.