Cold bend table..

Cold bend table..

ekjerside
Contributor Contributor
1,350 Views
20 Replies
Message 1 of 21

Cold bend table..

ekjerside
Contributor
Contributor

Hi 

 

Help...please.

 

I need help to build the if statement. In line 26 I am trying to build a If statement that choose the Heat treatment according tabel CBT PHBT.png , see attachment.  My first goal is put that heat treatment inside the text line thats start at line 30 and put at the end of line 39.. 

 

Please help...thank you very much in advance...

 

 

 

 

 

 

 

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;Variables
(defun c:cbt ( / 
		A_ITEM A_DIM A_DIMCAL A_THX A_THXCAL A_BENDRADIUS A_INCONEL_LAYER UMAX1 ETI1 A_THX_1 ETO1 TFR1 FIP1 RB_A_DIM A_BENDRATIO PHBT1 CONF1
		B_ITEM B_DIM B_THX B_BENDRADIUS B_INCONEL_LAYER UMAX2 ETI2 B_THX_2 ETO2 TFR2 RB_A_DIM PHBT2
		C_ITEM C_DIM C_THX C_BENDRADIUS C_INCONEL_LAYER UMAX3 ETI3 C_THX_3 ETO3 TFR3 RB_C_DIM PHBT3
		D_ITEM D_DIM D_THX D_BENDRADIUS D_INCONEL_LAYER UMAX4 ETI4 D_THX_4 ETO4 TFR4 RB_D_DIM PHBT4)
;;questions for user input 1 - line 1
(setq A_ITEM (getreal "\nItem no, for line 1? : "))
(setq A_DIM (getreal "\nOutside, Diameter of tube, for line 1? [mm]: "))
(setq A_THX (getreal "\nThickness of tube, for line 1? [mm]: "))
(setq A_BENDRADIUS (getreal "\nBend radius to center of tube, for line 1? [mm]: "))
(setq A_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 1? [mm]: "))
;;Calculations of line
;;calculation of do
(setq A_DIMCAL (+ A_DIM (* A_INCONEL_LAYER 2))) 
;;calculation of et
(setq A_THXCAL (+ A_THX A_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq RB_A_DIM (/ A_BENDRADIUS (+ A_DIM (* A_INCONEL_LAYER 2))))
(setq A_BENDRATIO (rtos RB_A_DIM 2 2))
;;calculation of TFR
(Setq TFR1 (/(* A_DIMCAL A_DIMCAL) (* A_THXCAL A_BENDRADIUS)))
;;selection of PHBT according to tabel
(if
  (< A_DIMCAL 142) and (> RB_A_DIM 2.5)
  (progn "No post-bend heat treatment required")
  )
;;-----------------------
;;CONFIGURATION OF LINE 1
;;-----------------------
(setq CONF1 (strcat "ITEM NO, LINE 1 = " (RTOS A_ITEM 2 2) " - "
						  "calculated D0 line 1 = " (rtos A_DIMCAL 2 2) " - "
						  "calculated et THICKNESS LINE 1 = " (RTOS A_THXCAL 2 2)  " - "
						  "BENDRADIUS = " (rtos A_BENDRADIUS 2 2) " - "
						  "RB line 1 / Diameter line 1 = " (rtos RB_A_DIM 2 2) " - "  
						  "TFR line 1 = " (rtos TFR1 2 2)
						  "PHBT = " )) 
(setq FIP1 (getpoint "\nChoose Text Insert Point:"))
(Command "-style" "WEIGHT" "ISOCP.shx" "3.5" "1" "0" "n" "n")
(Command "text" "s" "WEIGHT" "j" "MC" FIP1 "0" CONF1)
)

 

 

 

  

0 Likes
Accepted solutions (3)
1,351 Views
20 Replies
Replies (20)
Message 2 of 21

komondormrex
Mentor
Mentor

 

 

 

(cond
	(
  		(or
			(and (> A_DIMCAL 142) (> RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142)(> RB_A_DIM 1.3))
		)
  			(setq phbt "No post-bend heat treatment required")
	)
	(
		(or
			(and (> A_DIMCAL 142) (<= RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142) (<= RB_A_DIM 1.3))

		)
  			(setq phbt "Stress relieve")
	)
	(
		t
  			(setq phbt "Unknown condition")
	)
)

 

 

and change line 39 to "PHBT= " phbt))

 

will be 

 

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;Variables
(defun c:cbt ( / 
		A_ITEM A_DIM A_DIMCAL A_THX A_THXCAL A_BENDRADIUS A_INCONEL_LAYER UMAX1 ETI1 A_THX_1 ETO1 TFR1 FIP1 RB_A_DIM A_BENDRATIO PHBT1 CONF1
		B_ITEM B_DIM B_THX B_BENDRADIUS B_INCONEL_LAYER UMAX2 ETI2 B_THX_2 ETO2 TFR2 RB_A_DIM PHBT2
		C_ITEM C_DIM C_THX C_BENDRADIUS C_INCONEL_LAYER UMAX3 ETI3 C_THX_3 ETO3 TFR3 RB_C_DIM PHBT3
		D_ITEM D_DIM D_THX D_BENDRADIUS D_INCONEL_LAYER UMAX4 ETI4 D_THX_4 ETO4 TFR4 RB_D_DIM PHBT4)
;;questions for user input 1 - line 1
(setq A_ITEM (getreal "\nItem no, for line 1? : "))
(setq A_DIM (getreal "\nOutside, Diameter of tube, for line 1? [mm]: "))
(setq A_THX (getreal "\nThickness of tube, for line 1? [mm]: "))
(setq A_BENDRADIUS (getreal "\nBend radius to center of tube, for line 1? [mm]: "))
(setq A_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 1? [mm]: "))
;;Calculations of line
;;calculation of do
(setq A_DIMCAL (+ A_DIM (* A_INCONEL_LAYER 2))) 
;;calculation of et
(setq A_THXCAL (+ A_THX A_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq RB_A_DIM (/ A_BENDRADIUS (+ A_DIM (* A_INCONEL_LAYER 2))))
(setq A_BENDRATIO (rtos RB_A_DIM 2 2))
;;calculation of TFR
(Setq TFR1 (/(* A_DIMCAL A_DIMCAL) (* A_THXCAL A_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> A_DIMCAL 142) (> RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142)(> RB_A_DIM 1.3))
		)
  			(setq phbt "No post-bend heat treatment required")
	)
	(
		(or
			(and (> A_DIMCAL 142) (<= RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142) (<= RB_A_DIM 1.3))
		)
  			(setq phbt "Stress relieve")
	)
	(
		t
  			(setq phbt "Unknown condition")
	)
)
;;-----------------------
;;CONFIGURATION OF LINE 1
;;-----------------------
(setq CONF1 (strcat "ITEM NO, LINE 1 = " (RTOS A_ITEM 2 2) " - "
						  "calculated D0 line 1 = " (rtos A_DIMCAL 2 2) " - "
						  "calculated et THICKNESS LINE 1 = " (RTOS A_THXCAL 2 2)  " - "
						  "BENDRADIUS = " (rtos A_BENDRADIUS 2 2) " - "
						  "RB line 1 / Diameter line 1 = " (rtos RB_A_DIM 2 2) " - "  
						  "TFR line 1 = " (rtos TFR1 2 2)
						  "PHBT = " bhbt)
) 
(setq FIP1 (getpoint "\nChoose Text Insert Point:"))
(Command "-style" "WEIGHT" "ISOCP.shx" "3.5" "1" "0" "n" "n")
(Command "text" "s" "WEIGHT" "j" "MC" FIP1 "0" CONF1)
)

 

0 Likes
Message 3 of 21

ekjerside
Contributor
Contributor

Do i need in front of COND ? Like IF (Cond) !???

0 Likes
Message 4 of 21

komondormrex
Mentor
Mentor

no extra if. that is it.

0 Likes
Message 5 of 21

ekjerside
Contributor
Contributor

Thank you very much....for the first help... The next step is that I need help to change the code to put the

following variables in the attached block instead of the text line.  So how do I sync the variables to right tag in the attached block. 

 

Variable in lisp

Tag in block

A_ITEM

A_ITEM

A_DIMCAL

A_DIMCAL

A_THXCAL

A_THXCAL

A_BENDRADIUS

A_BENDRADIUS

RB_A_DIM

A_BENDRATIO

A_PBHT

A_PBHT

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;Variables
(defun c:cbt ( / 
		A_ITEM A_DIM A_DIMCAL A_THX A_THXCAL A_BENDRADIUS A_INCONEL_LAYER UMAX1 ETI1 A_THX_1 ETO1 A_TFR FIP1 RB_A_DIM A_BENDRATIO A_PHBT CONF1
		B_ITEM B_DIM B_THX B_BENDRADIUS B_INCONEL_LAYER UMAX2 ETI2 B_THX_2 ETO2 TFR2 RB_A_DIM PHBT2
		C_ITEM C_DIM C_THX C_BENDRADIUS C_INCONEL_LAYER UMAX3 ETI3 C_THX_3 ETO3 TFR3 RB_C_DIM PHBT3
		D_ITEM D_DIM D_THX D_BENDRADIUS D_INCONEL_LAYER UMAX4 ETI4 D_THX_4 ETO4 TFR4 RB_D_DIM PHBT4)
;;questions for user input 1 - line 1
(setq A_ITEM (getreal "\nItem no, for line 1? : "))
(setq A_DIM (getreal "\nOutside, Diameter of tube, for line 1? [mm]: "))
(setq A_THX (getreal "\nThickness of tube, for line 1? [mm]: "))
(setq A_BENDRADIUS (getreal "\nBend radius to center of tube, for line 1? [mm]: "))
(setq A_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 1? [mm]: "))
;;Calculations of line
;;calculation of do
(setq A_DIMCAL (+ A_DIM (* A_INCONEL_LAYER 2))) 
;;calculation of et
(setq A_THXCAL (+ A_THX A_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq RB_A_DIM (/ A_BENDRADIUS (+ A_DIM (* A_INCONEL_LAYER 2))))
(setq A_BENDRATIO (rtos RB_A_DIM 2 2))
;;calculation of TFR
(Setq A_TFR (/(* A_DIMCAL A_DIMCAL) (* A_THXCAL A_BENDRADIUS)))
;;selection of A_PHBT according to tabel
(cond
	(
  		(or
			(and (> A_DIMCAL 142) (> RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142)(> RB_A_DIM 1.3))
		)
  			(setq A_PHBT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> A_DIMCAL 142) (<= RB_A_DIM 2.5))
  			(and (<= A_DIMCAL 142) (<= RB_A_DIM 1.3))

		)
  			(setq A_PHBT "Stress relieve")
	)
	(
		t
  			(setq A_PHBT "No PBHT required")
	)
)
;;-----------------------
;;CONFIGURATION OF LINE 1
;;-----------------------
(setq CONF1 (strcat "ITEM NO, LINE 1 = " (RTOS A_ITEM 2 2) " - "
						  " - calculated D0 line 1 = " (rtos A_DIMCAL 2 2) " - "
						  " - calculated et THICKNESS LINE 1 = " (RTOS A_THXCAL 2 2)  " - "
						  " - BENDRADIUS = " (rtos A_BENDRADIUS 2 2) " - "
						  " - RB line 1 / Diameter line 1 = " (rtos RB_A_DIM 2 2) " - "  
						  " - TFR line 1 = " (rtos A_TFR 2 2)
						  " - PHBT = " A_PHBT)
) 
(setq FIP1 (getpoint "\nChoose Text Insert Point:"))
(Command "-style" "WEIGHT" "ISOCP.shx" "3.5" "1" "0" "n" "n")
(Command "text" "s" "WEIGHT" "j" "MC" FIP1 "0" CONF1)
)​

 

 

 

 

0 Likes
Message 6 of 21

komondormrex
Mentor
Mentor

add these lines at the end of the code.

 

(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(A_ITEM A_DIMCAL A_THXCAL A_BENDRADIUS RB_A_DIM A_TFR A_PHBT))
			(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	)
)
0 Likes
Message 7 of 21

ekjerside
Contributor
Contributor

Hi again

 

I have triede to clean it up a little. But....

 

1. I can't get an output from 'cond' of the PBHT. No matter what tube data I put in....what to do?

2. I there a way to make the user select the routine by depending what line in the the user want to sync data to? As you can see I have now called the routines CBT1, CBT2, CB3 and CBT4 depending what line they want to edit in block. But I would like to have the user to commando to use instead of four.  attached the Block CBT.dwg

 

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;;;;--------------------
;;;;;--------Line 1------
;;;;;--------------------
(defun c:cbt1 ( / 
		A_ITEM A_DIM A_DIMCAL A_THX A_THXCAL A_BENDRADIUS A_INCONEL_LAYER A_TFR A_BENDRATIO A_PBHT)
;;questions for user input - line 1
(setvar "cmdecho" 0)
(setq A_ITEM (getreal "\nItem no, for line 1? : "))
(setq A_DIM (getreal "\nOutside, Diameter of tube, for line 1? [mm]: "))
(setq A_THX (getreal "\nThickness of tube, for line 1? [mm]: "))
(setq A_BENDRADIUS (getreal "\nBend radius to center of tube, for line 1? [mm]: "))
(setq A_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 1? [mm]: "))
;;Calculations of line
;;calculation of do
(setq A_DIMCAL (+ A_DIM (* A_INCONEL_LAYER 2))) 
;;calculation of et
(setq A_THXCAL (+ A_THX A_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq A_BENDRATIO (/ A_BENDRADIUS (+ A_DIM (* A_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq A_TFR (/(* A_DIMCAL A_DIMCAL) (* A_THXCAL A_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> A_DIMCAL 142) (> A_BENDRATIO 2.5))
  			(and (<= A_DIMCAL 142)(> A_BENDRATIO 1.3))
		)
  			(setq A_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> A_DIMCAL 142) (<= A_BENDRATIO 2.5))
  			(and (<= A_DIMCAL 142) (<= A_BENDRATIO 1.3))

		)
  			(setq A_PBHT "Stress relieve")
	)
	(
		t
  			(setq A_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(A_ITEM A_DIMCAL A_THXCAL A_INCONEL_LAYER A_BENDRADIUS A_BENDRATIO A_TFR A_PBHT))
			(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 2------
;;;;;--------------------
(defun c:cbt2 ( / 
		B_ITEM B_DIM B_DIMCAL B_THX B_THXCAL B_BENDRADIUS B_INCONEL_LAYER B_TFR B_BENDRATIO B_PBHT)
;;questions for user input - line 2
(setvar "cmdecho" 0)
(setq B_ITEM (getreal "\nItem no, for line 2? : "))
(setq B_DIM (getreal "\nOutside, Diameter of tube, for line 2? [mm]: "))
(setq B_THX (getreal "\nThickness of tube, for line 2? [mm]: "))
(setq B_BENDRADIUS (getreal "\nBend radius to center of tube, for line 2? [mm]: "))
(setq B_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 2? [mm]: "))
;;Calculations of line
;;calculation of do
(setq B_DIMCAL (+ B_DIM (* B_INCONEL_LAYER 2))) 
;;calculation of et
(setq B_THXCAL (+ B_THX B_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq B_BENDRATIO (/ B_BENDRADIUS (+ B_DIM (* B_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq B_TFR (/(* B_DIMCAL B_DIMCAL) (* B_THXCAL B_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> B_DIMCAL 142) (> B_BENDRATIO 2.5))
  			(and (<= B_DIMCAL 142)(> B_BENDRATIO 1.3))
		)
  			(setq B_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> B_DIMCAL 142) (<= B_BENDRATIO 2.5))
  			(and (<= B_DIMCAL 142) (<= B_BENDRATIO 1.3))

		)
  			(setq B_PBHT "Stress relieve")
	)
	(
		t
  			(setq B_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(B_ITEM B_DIMCAL B_THXCAL B_INCONEL_LAYER B_BENDRADIUS B_BENDRATIO B_TFR B_PBHT))
			(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 3------
;;;;;--------------------
;;Variables
(defun c:cbt3 ( / 
		C_ITEM C_DIM C_DIMCAL C_THX C_THXCAL C_BENDRADIUS C_INCONEL_LAYER C_TFR C_BENDRATIO C_PBHT)
;;questions for user input line 3
(setvar "cmdecho" 0)
(setq C_ITEM (getreal "\nItem no, for line 3? : "))
(setq C_DIM (getreal "\nOutside, Diameter of tube, for line 3? [mm]: "))
(setq C_THX (getreal "\nThickness of tube, for line 3? [mm]: "))
(setq C_BENDRADIUS (getreal "\nBend radius to center of tube, for line 3? [mm]: "))
(setq C_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 3? [mm]: "))
;;Calculations of line
;;calculation of do
(setq C_DIMCAL (+ C_DIM (* C_INCONEL_LAYER 2))) 
;;calculation of et
(setq C_THXCAL (+ C_THX C_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq C_BENDRATIO (/ C_BENDRADIUS (+ C_DIM (* C_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq C_TFR (/(* C_DIMCAL C_DIMCAL) (* C_THXCAL C_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> C_DIMCAL 142) (> C_BENDRATIO 2.5))
  			(and (<= C_DIMCAL 142)(> C_BENDRATIO 1.3))
		)
  			(setq C_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> C_DIMCAL 142) (<= C_BENDRATIO 2.5))
  			(and (<= C_DIMCAL 142) (<= C_BENDRATIO 1.3))

		)
  			(setq C_PBHT "Stress relieve")
	)
	(
		t
  			(setq C_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(C_ITEM C_DIMCAL C_THXCAL C_INCONEL_LAYER C_BENDRADIUS C_BENDRATIO C_TFR C_PBHT))
			(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 4------
;;;;;--------------------
;;Variables
(defun c:cbt4 ( / 
		D_ITEM D_DIM D_DIMCAL D_THX D_THXCAL D_BENDRADIUS D_INCONEL_LAYER D_TFR D_BENDRATIO D_PBHT)
;;questions for user input line 4
(setvar "cmdecho" 0)
(setq D_ITEM (getreal "\nItem no, for line 4? : "))
(setq D_DIM (getreal "\nOutside, Diameter of tube, for line 4? [mm]: "))
(setq D_THX (getreal "\nThickness of tube, for line 4? [mm]: "))
(setq D_BENDRADIUS (getreal "\nBend radius to center of tube, for line 4? [mm]: "))
(setq D_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line ¤? [mm]: "))
;;Calculations of line
;;calculation of do
(setq D_DIMCAL (+ D_DIM (* D_INCONEL_LAYER 2))) 
;;calculation of et
(setq D_THXCAL (+ D_THX D_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq D_BENDRATIO (/ D_BENDRADIUS (+ D_DIM (* D_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq D_TFR (/(* D_DIMCAL D_DIMCAL) (* D_THXCAL D_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> D_DIMCAL 142) (> D_BENDRATIO 2.5))
  			(and (<= D_DIMCAL 142)(> D_BENDRATIO 1.3))
		)
  			(setq D_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> D_DIMCAL 142) (<= D_BENDRATIO 2.5))
  			(and (<= D_DIMCAL 142) (<= D_BENDRATIO 1.3))

		)
  			(setq D_PBHT "Stress relieve")
	)
	(
		t
  			(setq D_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(D_ITEM D_DIMCAL D_THXCAL D_INCONEL_LAYER D_BENDRADIUS D_BENDRATIO D_TFR D_PBHT))
			(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	)
)
(setvar "cmdecho" 1)
(princ)
)
0 Likes
Message 8 of 21

komondormrex
Mentor
Mentor

hey,

what are exemplary numbers for  

_ITEM _DIM _DIMCAL _THX _THXCAL _BENDRADIUS _INCONEL_LAYER

for all 4 lines?

0 Likes
Message 9 of 21

ekjerside
Contributor
Contributor

Hey

 

I attacked some exampels of tubes, maybe that could help...

0 Likes
Message 10 of 21

ekjerside
Contributor
Contributor

Hi...

 

i got an error message saying this:

Pick a block to put attributes into: ; error: bad argument type: numberp: "No post-bend heat treatment required"

when I try to put data into line 2.

0 Likes
Message 11 of 21

komondormrex
Mentor
Mentor

hi,

that is because it tries to rtos a string. try this one for assigning attributes values.

 

 

(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(a_item a_dimcal a_thxcal a_bendradius a_dim a_tfr a_pbht))
		(cond
	  		(
			 	(= 'a_pbht (read (vla-get-tagstring attribute)))
			 		(vla-put-textstring attribute (vl-symbol-value (read (vla-get-tagstring attribute))))
			)
			(
			 	t
			 
	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
			)
		)
	)
)

 

i am wondering what is the procedure of filling in attributes in a block? because they have prefixes a, b, с, в it is not convenient for different tubes with numbers other than 1, 2, 3 and 4. 

 

0 Likes
Message 12 of 21

ekjerside
Contributor
Contributor

Hi..

 

Tried to add the line you wrote..but jumps direcly to the selecting of the block...?! Wonder why...

Another thing is that I am trying to make the user choose what line in table they want to add the data to....but after the user choose a line it still edits line 1 in the table, not 3 if the user has choose has put in 3. So the choosing doesn't work. attached the lisp routine.

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 

;;		Cbt command makes you choose what line should be edited in the Cold bend table
;:
;;
(Princ "CBT starts the editing of Cold bend tabel")
(defun c:cbt(/ choose)
(initget "1 2 3 4 x")
(Setq choose (getreal "\nWhat line dou want to edit in the coldbend table? [1,2,3 or 4 (x=exist)] "))
(cond 
		(	(or (null choose) (="x" choose)
			(Princ "\nUser existed.")
		)
		( 	(= "1" choose)
		(cbt1)
		)
		( 	(= "2" choose)
		(cbt2)
		)
		( 	(= "3" choose)
		(cbt3)
		)
		( 	(= "4" choose)
		(cbt4)
		)
		)
) ;; End condition
) ;; end of choose line edit
;;;;;--------------------
;;;;;--------Line 1------
;;;;;--------------------
(defun cbt1 ( / 
		A_ITEM 
		A_DIM 
		A_DIMCAL 
		A_THX 
		A_THXCAL 
		A_BENDRADIUS 
		A_INCONEL_LAYER 
		A_TFR 
		A_BENDRATIO 
		A_PBHT)
;;questions for user input - line 1
(setvar "cmdecho" 0)
(setq A_ITEM (getreal "\nItem no, for line 1? : "))
(setq A_DIM (getreal "\nOutside, Diameter of raw tube, for line 1? [mm]: "))
(setq A_THX (getreal "\nThickness of raw tube, for line 1? [mm]: "))
(setq A_BENDRADIUS (getreal "\nBend radius to center of tube, for line 1? [mm]: "))
(setq A_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 1? [mm]: "))
;;Calculations of line
;;calculation of do
(setq A_DIMCAL (+ A_DIM (* A_INCONEL_LAYER 2))) 
;;calculation of et
(setq A_THXCAL (+ A_THX A_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq A_BENDRATIO (/ A_BENDRADIUS (+ A_DIM (* A_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq A_TFR (/(* A_DIMCAL A_DIMCAL) (* A_THXCAL A_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> A_DIMCAL 142) (> A_BENDRATIO 2.5))
  			(and (<= A_DIMCAL 142)(> A_BENDRATIO 1.3))
		)
  			(setq A_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> A_DIMCAL 142) (<= A_BENDRATIO 2.5))
  			(and (<= A_DIMCAL 142) (<= A_BENDRATIO 1.3))

		)
  			(setq A_PBHT "Stress relieve")
	)
	(
		t
  			(setq A_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
;;(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	;;(if (member (read (vla-get-tagstring attribute)) '(A_ITEM A_DIMCAL A_THXCAL A_INCONEL_LAYER A_BENDRADIUS A_BENDRATIO A_TFR A_PBHT))
			;;(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	;;)
;;)
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(A_ITEM A_DIMCAL A_THXCAL A_INCONEL_LAYER A_BENDRADIUS A_BENDRATIO A_TFR A_PBHT))
		(cond
	  		(
			 	(= 'A_PBHT (read (vla-get-tagstring attribute)))
			 		(vla-put-textstring attribute (vl-symbol-value (read (vla-get-tagstring attribute))))
			)
			(
			 	t
			 
	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 2------
;;;;;--------------------
(defun cbt2 ( / 
		B_ITEM 
		B_DIM 
		B_DIMCAL 
		B_THX 
		B_THXCAL 
		B_BENDRADIUS 
		B_INCONEL_LAYER 
		B_TFR 
		B_BENDRATIO 
		B_PBHT)
;;questions for user input - line 2
(setvar "cmdecho" 0)
(setq B_ITEM (getreal "\nItem no, for line 2? : "))
(setq B_DIM (getreal "\nOutside, Diameter of raw tube, for line 2? [mm]: "))
(setq B_THX (getreal "\nThickness of raw tube, for line 2? [mm]: "))
(setq B_BENDRADIUS (getreal "\nBend radius to center of tube, for line 2? [mm]: "))
(setq B_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 2? [mm]: "))
;;Calculations of line
;;calculation of do
(setq B_DIMCAL (+ B_DIM (* B_INCONEL_LAYER 2))) 
;;calculation of et
(setq B_THXCAL (+ B_THX B_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq B_BENDRATIO (/ B_BENDRADIUS (+ B_DIM (* B_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq B_TFR (/(* B_DIMCAL B_DIMCAL) (* B_THXCAL B_BENDRADIUS)))
;;selection of PHBT according to tabel
;;(cond
	(
  		(or
			(and (> B_DIMCAL 142) (> B_BENDRATIO 2.5))
  			(and (<= B_DIMCAL 142)(> B_BENDRATIO 1.3))
		)
  			(setq B_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> B_DIMCAL 142) (<= B_BENDRATIO 2.5))
  			(and (<= B_DIMCAL 142) (<= B_BENDRATIO 1.3))

		)
  			(setq B_PBHT "Stress relieve")
	)
	(
		t
  			(setq B_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
;;(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	;;(if (member (read (vla-get-tagstring attribute)) '(B_ITEM B_DIMCAL B_THXCAL B_INCONEL_LAYER B_BENDRADIUS B_BENDRATIO B_TFR B_PBHT))
			;;(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	;;)
;;)
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(B_ITEM B_DIMCAL B_THXCAL B_INCONEL_LAYER B_BENDRADIUS B_BENDRATIO B_TFR B_PBHT))
		(cond
	  		(
			 	(= 'B_PBHT (read (vla-get-tagstring attribute)))
			 		(vla-put-textstring attribute (vl-symbol-value (read (vla-get-tagstring attribute))))
			)
			(
			 	t
			 
	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 3------
;;;;;--------------------
;;Variables
(defun cbt3 ( / 
		C_ITEM C_DIM C_DIMCAL C_THX C_THXCAL C_BENDRADIUS C_INCONEL_LAYER C_TFR C_BENDRATIO C_PBHT)
;;questions for user input line 3
(setvar "cmdecho" 0)
(setq C_ITEM (getreal "\nItem no, for line 3? : "))
(setq C_DIM (getreal "\nOutside, Diameter of raw tube, for line 3? [mm]: "))
(setq C_THX (getreal "\nThickness of raw tube, for line 3? [mm]: "))
(setq C_BENDRADIUS (getreal "\nBend radius to center of tube, for line 3? [mm]: "))
(setq C_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line 3? [mm]: "))
;;Calculations of line
;;calculation of do
(setq C_DIMCAL (+ C_DIM (* C_INCONEL_LAYER 2))) 
;;calculation of et
(setq C_THXCAL (+ C_THX C_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq C_BENDRATIO (/ C_BENDRADIUS (+ C_DIM (* C_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq C_TFR (/(* C_DIMCAL C_DIMCAL) (* C_THXCAL C_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> C_DIMCAL 142) (> C_BENDRATIO 2.5))
  			(and (<= C_DIMCAL 142)(> C_BENDRATIO 1.3))
		)
  			(setq C_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> C_DIMCAL 142) (<= C_BENDRATIO 2.5))
  			(and (<= C_DIMCAL 142) (<= C_BENDRATIO 1.3))

		)
  			(setq C_PBHT "Stress relieve")
	)
	(
		t
  			(setq C_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
;;(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	;;(if (member (read (vla-get-tagstring attribute)) '(C_ITEM C_DIMCAL C_THXCAL C_INCONEL_LAYER C_BENDRADIUS C_BENDRATIO C_TFR C_PBHT))
		;;	(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	;;)
;;)
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(C_ITEM C_DIMCAL C_THXCAL C_INCONEL_LAYER C_BENDRADIUS C_BENDRATIO C_TFR C_PBHT))
		(cond
	  		(
			 	(= 'C_PBHT (read (vla-get-tagstring attribute)))
			 		(vla-put-textstring attribute (vl-symbol-value (read (vla-get-tagstring attribute))))
			)
			(
			 	t
			 
	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
(princ)
)
;;;;;--------------------
;;;;;--------Line 4------
;;;;;--------------------
;;Variables
(defun cbt4 ( / 
		D_ITEM D_DIM D_DIMCAL D_THX D_THXCAL D_BENDRADIUS D_INCONEL_LAYER D_TFR D_BENDRATIO D_PBHT)
;;questions for user input line 4
(setvar "cmdecho" 0)
(setq D_ITEM (getreal "\nItem no, for line 4? : "))
(setq D_DIM (getreal "\nOutside, Diameter of raw tube, for line 4? [mm]: "))
(setq D_THX (getreal "\nThickness of raw tube, for line 4? [mm]: "))
(setq D_BENDRADIUS (getreal "\nBend radius to center of tube, for line 4? [mm]: "))
(setq D_INCONEL_LAYER (getreal "\nSurface treatment, Inconel, Overlay , for line ¤? [mm]: "))
;;Calculations of line
;;calculation of do
(setq D_DIMCAL (+ D_DIM (* D_INCONEL_LAYER 2))) 
;;calculation of et
(setq D_THXCAL (+ D_THX D_INCONEL_LAYER))
;;calculation of relationship between rb / d0
(setq D_BENDRATIO (/ D_BENDRADIUS (+ D_DIM (* D_INCONEL_LAYER 2))))
;;calculation of TFR
(Setq D_TFR (/(* D_DIMCAL D_DIMCAL) (* D_THXCAL D_BENDRADIUS)))
;;selection of PHBT according to tabel
(cond
	(
  		(or
			(and (> D_DIMCAL 142) (> D_BENDRATIO 2.5))
  			(and (<= D_DIMCAL 142)(> D_BENDRATIO 1.3))
		)
  			(setq D_PBHT "No post-bend heat treatment required")
	)
	(
		(or
			(and (> D_DIMCAL 142) (<= D_BENDRATIO 2.5))
  			(and (<= D_DIMCAL 142) (<= D_BENDRATIO 1.3))

		)
  			(setq D_PBHT "Stress relieve")
	)
	(
		t
  			(setq D_PBHT "No PBHT required")
	)
)
;;-------------------------
;;;;Sync data to block cbt
;;-------------------------
;;(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	;;(if (member (read (vla-get-tagstring attribute)) '(D_ITEM D_DIMCAL D_THXCAL D_INCONEL_LAYER D_BENDRADIUS D_BENDRATIO D_TFR D_PBHT))
			;;(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
	;;)
;;)
(foreach attribute (vlax-invoke (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))) 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) '(D_ITEM D_DIMCAL D_THXCAL D_INCONEL_LAYER D_BENDRADIUS D_BENDRATIO D_TFR D_PBHT))
		(cond
	  		(
			 	(= 'D_PBHT (read (vla-get-tagstring attribute)))
			 		(vla-put-textstring attribute (vl-symbol-value (read (vla-get-tagstring attribute))))
			)
			(
			 	t
			 
	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (vla-get-tagstring attribute))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
(princ)
)

 

 

0 Likes
Message 13 of 21

komondormrex
Mentor
Mentor
Accepted solution

try the following

(setq table_block_object (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))))

(setq table_line_no (getint "\nWhat table's line do you want to fill in [1/2/3/4]?: ")
      attribute_designation_letter (cdr (assoc table_line_no '((1 . "a") (2 . "b") (3 . "c") (4 . "d"))))
	  _item (getint (strcat "\nItem no, for line " (itoa table_line_no) "?: "))
	  _dim (getreal (strcat "\nOutside, Diameter of tube, for line " (itoa table_line_no) " in mm?: "))
	  _thx (getreal (strcat "\nThickness of tube, for line " (itoa table_line_no) " in mm?: "))
	  _bendradius (getreal (strcat "\nBend radius to center of tube, for line " (itoa table_line_no) " in mm?: "))
	  _inconel_layer (getreal  (strcat "\nSurface treatment, Inconel, Overlay, for line " (itoa table_line_no) " in mm?: "))
	  _dimcal (+ _dim (* _inconel_layer 2))
  	  _thxcal (+ _thx _inconel_layer)
	  _bendratio (/ _bendradius (+ _dim (* _inconel_layer 2)))
	  _tfr (/ (expt _dimcal 2) (* _thxcal _bendradius))
)
(cond
	(
  		(or
			(and (> _dimcal 142) (> _bendratio 2.5))
  			(and (<= _dimcal 142)(> _bendratio 1.3))
		)
  			(setq _pbht "No post-bend heat treatment required")
	)
	(
		(or
			(and (> _dimcal 142) (<= _bendratio 2.5))
  			(and (<= _dimcal 142) (<= _bendratio 1.3))

		)
  			(setq _pbht "Stress relieve")
	)
	(
		t
  			(setq _pbht "No PBHT required")
	)
)
(foreach attribute (vlax-invoke table_block_object 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) (read (strcat "(" (apply 'strcat (mapcar '(lambda (var) (strcat attribute_designation_letter var))
																			'("_item " "_dimcal " "_thxcal " "_bendradius " "_dim " "_tfr " "_pbht ")
																		  )
													 	   )
								       ")"
							       )
							)
		)
		(cond
	  		(
			 	(vl-string-search "_PBHT" (vla-get-tagstring attribute))
			 		(vla-put-textstring attribute (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))))
			)
			(
			 	t

	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))) 2 2))
			)
		)
	)
)
0 Likes
Message 14 of 21

ekjerside
Contributor
Contributor
Accepted solution

Hi...

 

Seems to be working change it a little bit.....thx alot...

 

;;cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;	Cbt command makes you choose what line should be edited in the Cold bend table
(Princ "CBT starts the editing of Cold bend tabel")
(defun c:cbt(/ )
(setvar "cmdecho" 0)
(setq table_block_object (vlax-ename->vla-object (car (entsel "\nPick a block to put attributes into: "))))

(setq table_line_no (getint "\nWhat table's line do you want to fill in [1/2/3/4]?: ")
      attribute_designation_letter (cdr (assoc table_line_no '((1 . "a") (2 . "b") (3 . "c") (4 . "d"))))
	  _item (getint (strcat "\nItem no, for line " (itoa table_line_no) "?: "))
	  _dim (getreal (strcat "\nOutside, Diameter of tube, for line " (itoa table_line_no) " in mm?: "))
	  _thx (getreal (strcat "\nThickness of tube, for line " (itoa table_line_no) " in mm?: "))
	  _bendradius (getreal (strcat "\nBend radius to center of tube, for line " (itoa table_line_no) " in mm?: "))
	  _inconel_layer (getreal  (strcat "\nSurface treatment, Inconel, Overlay, for line " (itoa table_line_no) " in mm?: "))
	  _dimcal (+ _dim (* _inconel_layer 2))
  	  _thxcal (+ _thx _inconel_layer)
	  _bendratio (/ _bendradius (+ _dim (* _inconel_layer 2)))
	  _tfr (/ (expt _dimcal 2) (* _thxcal _bendradius))
)
(cond
	(
  		(or
			(and (> _dimcal 142) (> _bendratio 2.5))
  			(and (<= _dimcal 142)(> _bendratio 1.3))
		)
  			(setq _pbht "No PBHT required")
	)
	(
		(or
			(and (> _dimcal 142) (<= _bendratio 2.5))
  			(and (<= _dimcal 142) (<= _bendratio 1.3))

		)
  			(setq _pbht "Stress relieve")
	)
	(
		t
  			(setq _pbht "--")
	)
)
(foreach attribute (vlax-invoke table_block_object 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) (read (strcat "(" (apply 'strcat (mapcar '(lambda (var) (strcat attribute_designation_letter var))
																			'("_item " "_dimcal " "_thxcal " "_bendradius " "_inconel_layer " "_dim " "_bendratio " "_tfr " "_pbht ")
																		  )
													 	   )
								       ")"
							       )
							)
		)
		(cond
	  		(
			 	(vl-string-search "_PBHT" (vla-get-tagstring attribute))
			 		(vla-put-textstring attribute (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))))
			)
			(
			 	t

	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
)

 

0 Likes
Message 15 of 21

ekjerside
Contributor
Contributor

Hi...@komondormrex 

 

Seams to be working but:

 

I would like to have a check if the user has choose the right block with the name 'Cold_bending_table'? before thy are asked about data?

 

If they have chosen the right block then lisp should continue...

If not then it should exit and print in the command line "Wrong block please choose the block named 'Cold_bending_table', please try again".

 

Thanx in advance....

0 Likes
Message 16 of 21

komondormrex
Mentor
Mentor
Accepted solution

put that at the beginning, before a user will start to input tube data.

 

 

(while (and
		   (if (setq block_ename (car (entsel "\nPick a block named \"Cold_bending_table\" to data in: ")))
				(progn
		   			(setq table_block_object (vlax-ename->vla-object block_ename))
		   			(if (or 
							 (/= "AcDbBlockReference" (vla-get-objectname table_block_object))
							 (/= "Cold_bending_table" (vla-get-name table_block_object))
						)
		   					(null (alert "You've picked wrong block or entity"))
		   					nil
		   			)
				)
				t
			)
	   )
)

 

 

 

0 Likes
Message 17 of 21

ekjerside
Contributor
Contributor

Hi...thank you very much...

 

Publish the code..

 

;;  cbt - Insert cold bend table of tubes of 4 items of tubes. 
;;      It calculates the the relationship between RB / D0 to find criteria for Heat treament ect. 
;;	Cbt command makes you choose what line should be edited in the Cold bend table
(Princ "CBT starts the editing of Cold bend tabel")
(defun c:cbt(/ )
(setvar "cmdecho" 0)
(while (and
		   (if (setq block_ename (car (entsel "\nPick a block named \"Cold_bending_table\" to data in: ")))
				(progn
		   			(setq table_block_object (vlax-ename->vla-object block_ename))
		   			(if (or 
							 (/= "AcDbBlockReference" (vla-get-objectname table_block_object))
							 (/= "Cold_bending_table" (vla-get-name table_block_object))
						)
		   					(null (alert "Yove've picked wrong block or entity"))
		   					nil
		   			)
				)
				t
			)
	   )
)
(setq table_line_no (getint "\nWhat table's line do you want to fill in [1/2/3/4]?: ")
      attribute_designation_letter (cdr (assoc table_line_no '((1 . "a") (2 . "b") (3 . "c") (4 . "d"))))
	  _item (getint (strcat "\nItem no, for line " (itoa table_line_no) "?: "))
	  _dim (getreal (strcat "\nOutside, Diameter of tube, for line " (itoa table_line_no) " in mm?: "))
	  _thx (getreal (strcat "\nThickness of tube, for line " (itoa table_line_no) " in mm?: "))
	  _bendradius (getreal (strcat "\nBend radius to center of tube, for line " (itoa table_line_no) " in mm?: "))
	  _inconel_layer (getreal  (strcat "\nSurface treatment, Inconel, Overlay, for line " (itoa table_line_no) " in mm?: "))
	  _dimcal (+ _dim (* _inconel_layer 2))
  	  _thxcal (+ _thx _inconel_layer)
	  _bendratio (/ _bendradius (+ _dim (* _inconel_layer 2)))
	  _tfr (/ (expt _dimcal 2) (* _thxcal _bendradius))
)
(cond
	(
  		(or
			(and (> _dimcal 142) (> _bendratio 2.5))
  			(and (<= _dimcal 142)(> _bendratio 1.3))
		)
  			(setq _pbht "No PBHT required")
	)
	(
		(or
			(and (> _dimcal 142) (<= _bendratio 2.5))
  			(and (<= _dimcal 142) (<= _bendratio 1.3))

		)
  			(setq _pbht "Stress relieve")
	)
	(
		t
  			(setq _pbht "--")
	)
)
(foreach attribute (vlax-invoke table_block_object 'getattributes)
	(if (member (read (vla-get-tagstring attribute)) (read (strcat "(" (apply 'strcat (mapcar '(lambda (var) (strcat attribute_designation_letter var))
																			'("_item " "_dimcal " "_thxcal " "_bendradius " "_inconel_layer " "_dim " "_bendratio " "_tfr " "_pbht ")
																		  )
													 	   )
								       ")"
							       )
							)
		)
		(cond
	  		(
			 	(vl-string-search "_PBHT" (vla-get-tagstring attribute))
			 		(vla-put-textstring attribute (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))))
			)
			(
			 	t

	  				(vla-put-textstring attribute (rtos (vl-symbol-value (read (substr (vla-get-tagstring attribute) 2))) 2 2))
			)
		)
	)
)
(setvar "cmdecho" 1)
)

 

0 Likes
Message 18 of 21

ekjerside
Contributor
Contributor

Hi... @komondormrex 

 

If I would like to have DCL dialog box added to the lisp so the block table would be displayed as DCL dialog box? Can you give me an hint or some exampels based on the exsisting ctb.lsp....!?

 

 

0 Likes
Message 19 of 21

ekjerside
Contributor
Contributor

Hi... @komondormrex 

 

If I would like to have DCL dialog box added to the lisp so the block table would be displayed as DCL dialog box? Can you give me an hint or some exampels based on the exsisting ctb.lsp....!?

 

0 Likes
Message 20 of 21

ekjerside
Contributor
Contributor

Hi... @komondormrex  

 

If I would like to have DCL dialog box added to the lisp so the block table would be displayed as DCL dialog box? Can you give me an hint or some exampels based on the exsisting ctb.lsp....!? I have added CTB.LSP

 

0 Likes