AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WD_PNLM, and AEPANELCONFIG: why won't my lisp do what AEPANELCONFIG does?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
879 Views, 7 Replies

WD_PNLM, and AEPANELCONFIG: why won't my lisp do what AEPANELCONFIG does?

I wrote a lisp that finds our border scale, and adjusts the attributes on the WD_PNLM block accordingly.

It changes the: BALL_ASZ, BALL_ATYP, BALL_CDIA, BALL_TSZ, BALL_TYPE attributes.

The attribute values get changed but the bubbles that are drawn don't seem to be using that data. They seem to be using the previous data prior to being changed.

If I start the AEPANELCONFIG and simply cancel out, now the bubbles will be the size dictated by the WD_PNLM attributes that my lisp wrote to them.

When I do start AEPANELCONFIG it sees the new values that my lisp wrote to the attributes.

 

I am not sure what AEPANELCONFIG is doing, but it is doing more than just modifying the attributes on WD_PNLM apparently.

 

I am trying to avoid having the user start AEPANELCONFIG just to finsish the bubble size setup.

I woud like my users to just issue my bubble config  lisp, then go right to the bubble command (AEBALlOON) and have the bubbles be sized according to the WD_PNLM attributes.

 

I could use some help, I am stuck.

 

 

 

7 REPLIES 7
Message 2 of 8
rhesusminus
in reply to: Anonymous

Have a look at the following variables:

 

GBL_WD_PSYMATTRSCL
GBL_WD_PSYMSCL
GBL_WD_PSYMATTR_DISABLED
GBL_WD_PSYMATTR_TEXTSIZE_MODE

 

Maybe that helps you?


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 3 of 8
Anonymous
in reply to: rhesusminus

All but GBL_WD_PSYMATTRSCL (evaluates to 1.0) are nil.

 

 

 

 

 

Message 4 of 8
rhesusminus
in reply to: Anonymous

Try making changes for the panel configuration, and have a look at them again.

 

Also the variable

 

GBL_WD_PNLM

 

contains a ton of information,

 

You guess you can set this information using SETQ in your program...

 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 5 of 8
Anonymous
in reply to: rhesusminus

Ok, GBL_WD_PNLM contains a nice list of values... a bunch of strings, and one list containing a string, I don't know what they point to yet...

 

I am bothered by the "GBL"... that usually indicates a global variable for ACE...

 

But I'll run with this for a bit and see what happens.

 

The AEPANELCONFIG does alter those values..., hopefully altering those values makes the bubbles take on the new values in WD_PNLM without starting the AEPANELCONFIG.

 

I'll test that.

Message 6 of 8
Anonymous
in reply to: rhesusminus

Ok, gbl_wd_pnlm did the trick, it appears that AEBALLOON accesses that variable to draw the bubbles.

Once gbl_wd_pnlm is set, and AEBALLOON is issued, WD_PNLM block attributes will be updated as well.

 

I was curious to know how you knew about, or discovered, this variable?

 

It might be handy to know if there was some way I could have found this thing myself...

 

Thanks for the help!

 

 

 

 

 

Message 7 of 8
yan_ken
in reply to: Anonymous

Hi there,

 

I was hoping if you could share your lisp file. I am trying to do something similar where I can have two different balloon sizes. I am planning to have two lisps, one for each size.

 

 

Thanks,

Ken

Message 8 of 8
Anonymous
in reply to: yan_ken

 

;;;;
;;;;
;;;;!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!
;;;;^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^
;;;;!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!
;;;;
;;;;Title:
;;;;		bcon.lsp
;;;;By:
;;;;		Darrell.Gregg
;;;;		All rights reserved
;;;;Create date:
;;;;		04/07/2014
;;;;Version:
;;;		1.0: initial release
;;;		1.1: made code more compact, reduced number of local variables, addition of setting GBL_WD_PNLM
;;;		1.2: added function help definition.
;;;		1.3: removed help function, function runs without user input, no chance to press "F1" for help.;;;		
;;;		1.4: changed the gbl_wd_pnlm listing to include the PLAY flag setting to "2" from "0".
;;;		1.5: changed command definition to be a function call rather than command line.
;;;;Function:
;;;;		
;;;;Description:
;;;;		alters the ball_tsz, ball_asz, ball_cdia, ball_type, and ball_atyp, for the "wd_pnlm" block
;;;		it then sets the values of the autocad-electrical variable GBL_WD_PNLM variable
;;;		which allows the bubble text/arrow/circle size to be scaled to the border...
;;;		FYI: AEBALLOON reads GBL_WD_PNLM to know how to draw the bubble (txt/arrow size, circle diameter, etc...)
;;;		     AEBALLOON will also force the WD_PNLM attributes to be set to the values held in GBL_WD_PNLM at the
;;;		     time AEBALLOON command is issued.
;;;;Argument(s):
;;;;		
;;;;Local Variable(s):
;;;;		entnam entname entlist old_val new_val
;;;;Returned Value(s):
;;;;		none
;;;;Displayed Values:
;;;;		none
;;;;Usage:
;;;;		(bcon);;;;
;;;;!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!
;;;;^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^
;;;;!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!-^-!
;;;
;SUBFUNCTOIN BSCALE (returns value of border scale)
(defun bscale (/ border_ss b_ename bsx bsy bsz b_scale)
  (setq border_ss (ssget "x" '((2 . "acade d*"))));get a selection set of everything with the blockname "acade d*"
  (cond
    (; condition 1 = NO BORDER!!
     (null border_ss);test 1
     (princ "\nNo border!! aborting...");result 1
     );end condition 1
    (; condition 2 = TOO MANY BORDERS!!
     (/= (sslength border_ss) 1);test 2
     (princ "\nToo many borders!! aborting...")
     );end condition 2
    (; condition 3 = SCALES DO NOT MATCH!!
     (progn;long setup then the test hopefully this works
       (setq b_ename (ssname border_ss 0))
       (setq bsx (cdr (assoc 41 (entget b_ename)))
	     bsy (cdr (assoc 42 (entget b_ename)))
	     bsz (cdr (assoc 43 (entget b_ename)))
	     )
       (not (= bsx bsy bsz));test 3...
       );end the progn above
      (princ "\nXYZ scales do not match!! aborting...")
     );end condition 3
    (; condition 4 = BORDER SCALE CAN BE USED!! ** final condition** will return border scale as an integer when done
     (= (sslength border_ss) 1);test 4
     (progn
       (setq b_ename (ssname border_ss 0));get the ename for the item in the selection set
       (setq b_scale (cdr (assoc 41 (entget b_ename))));find the x scale value and conver it to a floating number
       );result 4
     );end condition 4, will now bail totally
    );end conditional testing
;;;;;;  (princ);end quitely:::::: i took this out to make sure it passes a value back to the calling function
);end defun
;END SUBFUNCTION
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;------MAIN------
;;;function to alter WD_PNLM attributes that affect bubble scale.
;;;
(defun bcon (/ entnam entname entlist old_val new_val ball_tsz ball_asz ball_cdia ball_type ball_atyp);function definition and local variables
  (setq entnam (entnext));set entname equal to the first nondeleted entity in the database
  (while (setq entnam (entnext entnam));while there are entities in the database, get the next entity name from the database
    (setq entname (cdr (assoc 2 (entget entnam))));get the entity name from the current entity
    (cond
      (;condition 1: found "BALL_TSZ" (ball text size)
       (= entname "BALL_TSZ");if the entity name is "BALL_TSZ" then store its ename.
       (progn;if BALL_TSZ do the following:
	 (setq old_val (cdr (assoc 1 (entget entnam))));define old ball text value !!STRING!!
	 (setq new_val (rtos (* 0.1 (bscale))));set value to 0.1 times the value of the border scale
	 (setq ball_tsz new_val);create variable for GBL_WD_PNLM list
	 (setq entlist (entget entnam));create entity list for BALL_TSZ
	 ;;;  	>-->BALL_TSZ entlist
         (setq entlist (subst (car (list (cons 1 new_val))) (car (list (cons 1 old_val))) entlist));create new entity data list
         (entmod entlist);modify the entity database
         (entupd entnam);update the entity
	 );end progn
       );end condition 1
      (;condition 2: found "BALL_ASZ" (ball arrow size)
       (= entname "BALL_ASZ");if the entity name is "BALL_ASZ" then...
       (progn;do the following:
	 (setq old_val (cdr (assoc 1 (entget entnam))));define old ball text value !!STRING!!
	 (setq new_val (rtos (* 0.1 (bscale))));set value to 0.1 times the value of the border scale
 	 (setq ball_asz new_val);create variable for GBL_WD_PNLM list
	 (setq entlist (entget entnam));create entity list for BALL_TSZ
	 ;;;  	>-->BALL_ASZ entlist
         (setq entlist (subst (car (list (cons 1 new_val))) (car (list (cons 1 old_val))) entlist));create new entity data list
         (entmod entlist);modify the entity database
         (entupd entnam);update the entity
	 );end progn
       );end condition 2
      (;condition 3: found "BALL_CDIA" (ball circile diameter)...
       (= entname "BALL_CDIA")
       (progn;do the following:
	 (setq old_val (cdr (assoc 1 (entget entnam))));define old ball text value !!STRING!!
	 (setq new_val (rtos (* 0.25 (bscale))));set the value of the circle diameter to 2.5 times the text height, txt height = 0.1 x bscale
 	 (setq ball_cdia new_val);create variable for GBL_WD_PNLM list
	 (setq entlist (entget entnam));create entity list for BALL_TSZ
	 ;;;  	>-->BALL_CDIA entlist
         (setq entlist (subst (car (list (cons 1 new_val))) (car (list (cons 1 old_val))) entlist));create new entity data list
         (entmod entlist);modify the entity database
         (entupd entnam);update the entity
	 );end progn
       );end condition 3
      (;condition 4: found BALL_TYPE
       (= entname "BALL_TYPE");if the entity name is "BALL_TYPE" then...
       (progn;do the following:
	 (setq old_val (cdr (assoc 1 (entget entnam))));define old ball text value !!STRING!!
	 (setq new_val "1");set value to 1 which is a circle
  	 (setq ball_type new_val);create variable for GBL_WD_PNLM list
	 (setq entlist (entget entnam));create entity list for BALL_TSZ
	 ;;;  	>-->BALL_TYPE entlist
         (setq entlist (subst (car (list (cons 1 new_val))) (car (list (cons 1 old_val))) entlist));create new entity data list
         (entmod entlist);modify the entity database
         (entupd entnam);update the entity
	 );end progn
       );end condition 4
      (;condition 5: found BALL_ATYP
       (= entname "BALL_ATYP");if the entity name is "BALL_ATYP" then...
       (progn;do the following:
	 (setq old_val (cdr (assoc 1 (entget entnam))));define old ball text value !!STRING!!
	 (setq new_val "");null string, which is closed filled arrow.
  	 (setq ball_atyp new_val);create variable for GBL_WD_PNLM list
	 (setq entlist (entget entnam));create entity list for BALL_TSZ
	 ;;;  	>-->BALL_ATYP entlist
         (setq entlist (subst (car (list (cons 1 new_val))) (car (list (cons 1 old_val))) entlist));create new entity data list
         (entmod entlist);modify the entity database
         (entupd entnam);update the entity
	 );end progn
       );end condition 5
      );end conditional tests
    );end while
  (setq gbl_wd_pnlm
	 (list "1" "%N" BALL_TSZ "0.09" BALL_ATYP BALL_ASZ BALL_TYPE BALL_CDIA
	       "" "0.125" "0.375" "0.125" "1" "0.25" "p8_1" "0.375" "" "0.125" "PTAG" "PITEM"
	       "PDESC" "PMFG" "PCAT" "PLOC" "PMNT" "PGRP" "PTERM" "PWIRE" "PRTG" "PMISC"
	       "PBAL" '("PSYMS") "PNPG" "PNPT" "PNPD" "2" "PASSY" "0.000" "0.000" "1.0" "0.0"
	       "0.0" "0.0" "0" "1.0" ""
	       ));set gbl_wd_pnlm values, this will allow AEBALLONN to calculate the bubble sizes.
  (princ "\nBubble configuration complete...\n");advise user of status
  (princ);end quitely
  );end defun

This code is specific to our border block but you can probably figure out how to make it work for yours.

 

This is all based on our minimum printed font size of 0.2inches and a border base scale of 2 (historically they used an "A" sized border and just scaled it by 2 to get a B sized, then set the scale to back to 1, it's a bit complicated but that might explain some sizing things you see above).

This takes the place of the AEPANELCONFIG, once you run this you start the bubble command and bubble normally.

I actually have another LISP that calls this such that users can type "BA" and it runs this, then it runs the AEBALLON command for them.

So all the users sees is the system ready to draw bubbles, but the bubbles will be already set up to be scaled to standards.

I am also taking into account 3 digits for the bubble numbers, but not 4. Bubble sizes will be scaled for 3 digits. We often have 99 bubbles then someone adds something.... so then the  bubbles are not large enough to hold that third digit... so I account for 3 digits and size the bubble to that. Such that all bubbles are the same size on the drawing.

 

Enjoy!

 

Please give kudos if you find this code useful.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report