DieselExpression

DieselExpression

MBAlonso
Contributor Contributor
415 Views
5 Replies
Message 1 of 6

DieselExpression

MBAlonso
Contributor
Contributor

Hello!

 

I have the following expression:

 

$(+,$(rtos,$(substr,$(getvar,dwgname),9,2),1,0),1)

 

I would like to add a 0 if the value is less than 9 to get 01, 02, 03... 10, 11, etc.

 

Any idea?

 

Thanks!

0 Likes
Accepted solutions (1)
416 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

Must it be diesel ? This is a lisp example checks if sheet is <10. 

 

(if (< dwgnum 10.0) 
      (setq newstr2 (strcat dwgname "-D0"  (rtos sheetnum 2 0)))
      (setq newstr2 (strcat dwgname "-D"  (rtos sheetnum 2 0)))
)

 

0 Likes
Message 3 of 6

MBAlonso
Contributor
Contributor

Thanks.

 

Mmm... but I do not have the entire code using LSP.

0 Likes
Message 4 of 6

Kent1Cooper
Consultant
Consultant

@MBAlonso wrote:

....

I have the following expression:

$(+,$(rtos,$(substr,$(getvar,dwgname),9,2),1,0),1)

I would like to add a 0 if the value is less than 9 to get 01, 02, 03... 10, 11, etc.

....


The Diesel Functions Reference does not appear to include anything equivalent to the AutoLisp (strcat) function for joining [concatenating] text strings together.  Without something like that, it's hard to picture how you could get what you're after, but I don't use Diesel enough to feel sure about it.

Kent Cooper, AIA
0 Likes
Message 5 of 6

Paul_Gander
Advocate
Advocate
Accepted solution

Try this as a direct replacement for your expression:

$(if,$(<,$(substr,$(getvar,dwgname),9,2),9),0)$(+,$(substr,$(getvar,dwgname),9,2),1)

It should work although it's not really clear what you are trying to achieve. Is your expression part of a menu macro or a field? I'm guessing that you are wanting to do a SAVEAS with the incremented number in the drawing name.

 

0 Likes
Message 6 of 6

MBAlonso
Contributor
Contributor

Thanks everyone!

 

@Paul_Gander: I was trying (and I got it because of your help) to write the current page in a text (the number is part of the DWG name) and, in a second text, the following page.

 

For example: Page 01. Next Page 02.

 

 

 

 

0 Likes