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

Diesel Macro Help!

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
338 Views, 10 Replies

Diesel Macro Help!

I have written a diesel macro to draw a wide flange section using the
variables as following:

d=overall depth
bf=flange width
tf=flange thickness
tw=web thickness
k=the distance from top of flange to the fillet

The above values can be read from the section properties and input to
the command line. Then R=radius of fillet (R=k-tf) is calculated.

^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,tf);@$(-,$(/,$(GETENV,bf),2),$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(GETENV,R));;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;

The problem is the variable R did not show the value calculated. It
returns the value used last time instead whenever GETENV is called. I
know the key point is to delay the eval of everything after the Pline
command. But I don't know where to add a pair of " ". I tried to add
the beginning " in front of the Pline and the closing " at the end. The
macro stopped after the first point of Pline and all points after that
were not evaluated. I also tried a couple of other locations too but
couldn't get it works. Can someone help me on this? Or is it something
more than a pair of " "?

Regards,

Patrick Poon
Structural Steel Detailer
10 REPLIES 10
Message 2 of 11
rjvs
in reply to: Anonymous

Patrick

If you set MACROTRACE to 1, you can see where it breaks

in the History window...the F2 key.
Message 3 of 11
Anonymous
in reply to: Anonymous

Thanks for the advice. I did try MACROTRACE = 1 before I posted my
question. That's where I found the wrong R value returned when GETENV
is called. After I added some " to varies locations, the macro stopped
at somewhere that I don't know how to interpret 😞 So I am crossing my
fingers hoping someone will come to rescue.

Regards,

Patrick Poon
Structural Steel Detailer

rjvs wrote:
>
> Patrick
>
> If you set MACROTRACE to 1, you can see where it breaks
>
> in the History window...the F2 key.
Message 4 of 11
Anonymous
in reply to: Anonymous

When calling a DIESEL expression, you need to use the correct
syntax $M=$ every time.

--
Dean Saadallah
www.pendean.com
---
"Patrick Poon" wrote in message
news:3AFB00C8.A3538C08@telus.net...
> I have written a diesel macro to draw a wide flange section
using the
> variables as following:
>
> d=overall depth
> bf=flange width
> tf=flange thickness
> tw=web thickness
> k=the distance from top of flange to the fillet
>
> The above values can be read from the section properties and
input to
> the command line. Then R=radius of fillet (R=k-tf) is
calculated.
>
>
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SE
TENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV
,tf);@$(-,$(/,$(GETENV,bf),2),$(GETENV,R),$(/,$(GETENV,tw),2)),0;
A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d)
,2),$(GETENV,tf),$(GETENV,R));;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw
),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
>
> The problem is the variable R did not show the value
calculated. It
> returns the value used last time instead whenever GETENV is
called. I
> know the key point is to delay the eval of everything after the
Pline
> command. But I don't know where to add a pair of " ". I tried
to add
> the beginning " in front of the Pline and the closing " at the
end. The
> macro stopped after the first point of Pline and all points
after that
> were not evaluated. I also tried a couple of other locations
too but
> couldn't get it works. Can someone help me on this? Or is it
something
> more than a pair of " "?
>
> Regards,
>
> Patrick Poon
> Structural Steel Detailer
Message 5 of 11
Anonymous
in reply to: Anonymous

check my site for quote help, essentially you need to quote out the getenv,R and I don't see you needing anything else to be delayed
so just put in
"$M=
before the first getenv,R and then a quote (") at the end of you macro.

>
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,t
f);@$(-,$(/,$(GETENV,bf),2),

put it here

"$m=$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(GETENV,R)
)

put in th last quote any where past last getenv,r

";;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;

--
/*********Phil for diesel macro language help--->
http://www.grapevine.net/~lacy/index.html
reverse ycal for good email
************/
"Patrick Poon" wrote in message news:3AFB00C8.A3538C08@telus.net...
> I have written a diesel macro to draw a wide flange section using the
> variables as following:
>
> d=overall depth
> bf=flange width
> tf=flange thickness
> tw=web thickness
> k=the distance from top of flange to the fillet
>
> The above values can be read from the section properties and input to
> the command line. Then R=radius of fillet (R=k-tf) is calculated.
>
>
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,t
f);@$(-,$(/,$(GETENV,bf),2),$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),
$(GETENV,tf),$(GETENV,R));;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
>
> The problem is the variable R did not show the value calculated. It
> returns the value used last time instead whenever GETENV is called. I
> know the key point is to delay the eval of everything after the Pline
> command. But I don't know where to add a pair of " ". I tried to add
> the beginning " in front of the Pline and the closing " at the end. The
> macro stopped after the first point of Pline and all points after that
> were not evaluated. I also tried a couple of other locations too but
> couldn't get it works. Can someone help me on this? Or is it something
> more than a pair of " "?
>
> Regards,
>
> Patrick Poon
> Structural Steel Detailer
Message 6 of 11
Anonymous
in reply to: Anonymous

Not true Dean
The diesel call evaluates all diesel commands after it (except for the quote thing)
save your macro space and don't use unneeded $M='s

--
/*********Phil for diesel macro language help--->
http://www.grapevine.net/~lacy/index.html
reverse ycal for good email
************/
"Dean Saadallah" wrote in message news:06704989E903AB00F818EA7EF36C8D25@in.WebX.maYIadrTaRb...
> When calling a DIESEL expression, you need to use the correct
> syntax $M=$ every time.
>
> --
> Dean Saadallah
> www.pendean.com
> ---
> "Patrick Poon" wrote in message
> news:3AFB00C8.A3538C08@telus.net...
> > I have written a diesel macro to draw a wide flange section
> using the
> > variables as following:
> >
> > d=overall depth
> > bf=flange width
> > tf=flange thickness
> > tw=web thickness
> > k=the distance from top of flange to the fillet
> >
> > The above values can be read from the section properties and
> input to
> > the command line. Then R=radius of fillet (R=k-tf) is
> calculated.
> >
> >
> ^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SE
> TENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV
> ,tf);@$(-,$(/,$(GETENV,bf),2),$(GETENV,R),$(/,$(GETENV,tw),2)),0;
> A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d)
> ,2),$(GETENV,tf),$(GETENV,R));;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw
> ),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
> >
> > The problem is the variable R did not show the value
> calculated. It
> > returns the value used last time instead whenever GETENV is
> called. I
> > know the key point is to delay the eval of everything after the
> Pline
> > command. But I don't know where to add a pair of " ". I tried
> to add
> > the beginning " in front of the Pline and the closing " at the
> end. The
> > macro stopped after the first point of Pline and all points
> after that
> > were not evaluated. I also tried a couple of other locations
> too but
> > couldn't get it works. Can someone help me on this? Or is it
> something
> > more than a pair of " "?
> >
> > Regards,
> >
> > Patrick Poon
> > Structural Steel Detailer
>
Message 7 of 11
Anonymous
in reply to: Anonymous

Thanks Phil. I have added the pair of quote as suggested. It turned
out stopped in the middle. Let me paste the revised code here.

^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,tf);@$(-,$(/,$(GETENV,bf),2),"$M=$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(GETENV,R))";;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;

The following is copied from text window with macrotrace set to 1.

Command: _SETENV
Variable name: d
Value <23.625>:
Command: _SETENV
Variable name: bf
Value <7>:
Command: _SETENV
Variable name: tf
Value <.5>:
Command: _SETENV
Variable name: tw
Value <.375>:
Command: _SETENV
Variable name: K
Value <1>: 1.5

Command: _SETENV
Variable name: R
Value <0.5>: Eval: $(-, $(GETENV,K), $(GETENV,tf))
Eval: $(GETENV, K)
===> 1.5
Eval: $(GETENV, tf)
===> .5
===> 1
Eval: $(/, $(GETENV,bf), 2)
Eval: $(GETENV, bf)
===> 7
===> 3.5
Eval: $(GETENV, tf)
===> .5
$M=_PLINE

It seems that everything inside the quotes was not evaluated. Something
I don't understand is how come the Pline comamnd was prefixed with the
"$M=". Can you take a look and help?

Regards,

Patrick Poon
Structural Steel Detailer

Phil Lacy wrote:
>
> check my site for quote help, essentially you need to quote out the getenv,R and I don't see you needing anything else to be delayed
> so just put in
> "$M=
> before the first getenv,R and then a quote (") at the end of you macro.
>
> >
> ^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,t
> f);@$(-,$(/,$(GETENV,bf),2),
>
> put it here
>
> "$m=$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(GETENV,R)
> )
>
> put in th last quote any where past last getenv,r
>
> ";;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
>
> --
> /*********Phil for diesel macro language help--->
> http://www.grapevine.net/~lacy/index.html
> reverse ycal for good email
Message 8 of 11
Anonymous
in reply to: Anonymous

I believe you run into the macro length limit of diesel.

If I remember right I think it is only about 180 characters. definitely insufficient, unaddressed by autoDesk, and under your macro
length 😞

--
/*********Phil for diesel macro language help--->
http://www.grapevine.net/~lacy/index.html
reverse ycal for good email
************/
"Patrick Poon" wrote in message news:3AFC677E.DA6ABCF4@telus.net...
> Thanks Phil. I have added the pair of quote as suggested. It turned
> out stopped in the middle. Let me paste the revised code here.
>
>
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,t
f);@$(-,$(/,$(GETENV,bf),2),"$M=$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d)
,2),$(GETENV,tf),$(GETENV,R))";;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
>
> The following is copied from text window with macrotrace set to 1.
>
> Command: _SETENV
> Variable name: d
> Value <23.625>:
> Command: _SETENV
> Variable name: bf
> Value <7>:
> Command: _SETENV
> Variable name: tf
> Value <.5>:
> Command: _SETENV
> Variable name: tw
> Value <.375>:
> Command: _SETENV
> Variable name: K
> Value <1>: 1.5
>
> Command: _SETENV
> Variable name: R
> Value <0.5>: Eval: $(-, $(GETENV,K), $(GETENV,tf))
> Eval: $(GETENV, K)
> ===> 1.5
> Eval: $(GETENV, tf)
> ===> .5
> ===> 1
> Eval: $(/, $(GETENV,bf), 2)
> Eval: $(GETENV, bf)
> ===> 7
> ===> 3.5
> Eval: $(GETENV, tf)
> ===> .5
> $M=_PLINE
>
> It seems that everything inside the quotes was not evaluated. Something
> I don't understand is how come the Pline comamnd was prefixed with the
> "$M=". Can you take a look and help?
>
> Regards,
>
> Patrick Poon
> Structural Steel Detailer
>
> Phil Lacy wrote:
> >
> > check my site for quote help, essentially you need to quote out the getenv,R and I don't see you needing anything else to be
delayed
> > so just put in
> > "$M=
> > before the first getenv,R and then a quote (") at the end of you macro.
> >
> > >
> >
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw;\_SETENV;K;\_SETENV;R;$M=$(-,$(GETENV,K),$(GETENV,tf));_PLINE;\W;0;;@@0,$(GETENV,t
> > f);@$(-,$(/,$(GETENV,bf),2),
> >
> > put it here
> >
> >
"$m=$(GETENV,R),$(/,$(GETENV,tw),2)),0;A;R;$(GETENV,R);@$(GETENV,R),$(GETENV,R);L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(GETENV,R)
> > )
> >
> > put in th last quote any where past last getenv,r
> >
> > ";;MIRROR;LAST;;@0,0;@$(/,$(GETENV,tw),2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;
> >
> > --
> > /*********Phil for diesel macro language help--->
> > http://www.grapevine.net/~lacy/index.html
> > reverse ycal for good email
Message 9 of 11
Anonymous
in reply to: Anonymous

256 characters to be exact. the quickest way to complie these, is to write the code in a text file, then set up a new toolbar/button and the customise it. autocad automatically complies it into the aclt.mnc file. then paste into the button the code from the text file - aclt then automatically complies it - and dosent let you add any extra code that it can handle.
Message 10 of 11
Anonymous
in reply to: Anonymous

I've written code in the button customize window and it took it yet was over the limit of diesel. BTW, diesel has its own limit
separate from the AC macro limit if that's what you mean.

--
/*********Phil for diesel macro language help--->
http://www.grapevine.net/~lacy/index.html
reverse ycal for good email
************/
"dwane101" wrote in message news:f04c977.7@WebX.maYIadrTaRb...
> 256 characters to be exact. the quickest way to complie these, is to write the code in a text file, then set up a new
toolbar/button and the customise it. autocad automatically complies it into the aclt.mnc file. then paste into the button the code
from the text file - aclt then automatically complies it - and dosent let you add any extra code that it can handle.
>
Message 11 of 11
Anonymous
in reply to: Anonymous

Update to the macro.

I have finally solve the problem, though in a dumb way. I have followed
the direction from Phil Lacy and went to his web page for the help of
quotes for the delay of evaluation. I put the opening quote in front of
the first GETENV, R and the closing quotes after the last one. However,
the macro returned an error message saying the string is too long and
truncated. Then I tried to use two pairs of quotes. This time the
evaluation is not stable, the first time it's OK, then it returned
something incorrect. then I relocated the quotes until it functioned
normally (within the limit of DIESEL as we believer), but of course the
result is not correct since the quotes cannot cover all the variables to
be delayed. Then I have to find an alternative to do it by omitting the
Variable R, use K-tf instead (sort of long hand). So no delay is
necessary. It will be straight forward macro sequence but longer. I
have made a change to use half of the beam web (tw/2) instead of tw in
order to shorten the macro a little bit, though I am not sure if it
helps. Everything work fine now. So the limit of DIESEL with delay
included is not the same without delays. Anyway, I paste my macro
here. If anyone is following this thread and interested in DIESEL, and
if you can find a better way to do it, your comment is welcome.

Here is the DIESEL macro, watch the word wrap. There should be no space
in between.
^C^C_SETENV;d;\_SETENV;bf;\_SETENV;tf;\_SETENV;tw/2;\_SETENV;K;\_PLINE;\W;0;;@@0,$(GETENV,tf);@$(-,$(/,$(GETENV,bf),2),$(-,$(GETENV,K),$(GETENV,tf)),$(GETENV,tw/2)),0;A;R;$(-,$(GETENV,K),$(GETENV,tf));@$(-,$(GETENV,K),$(GETENV,tf)),$(-,$(GETENV,K),$(GETENV,tf));L;@0,$(-,$(/,$(GETENV,d),2),$(GETENV,tf),$(-,$(GETENV,K),$(GETENV,tf)));;MIRROR;LAST;;@0,0;@$(GETENV,tw/2),0;;MIRROR;LAST;;@0,0;@0,2;;MIRROR;LAST;;@0,-2;@2,0;;

Regards,

Patrick Poon
Structural Steel Detailer

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

Post to forums  

Autodesk Design & Make Report

”Boost