Jump to content

Recommended Posts

Posted

Ok, here we go again,

Im getting addicted to it.

Am trying trying and trying.

 

I am giving the DCL 3 options to start, Opening the window sash from LEFT, RIGHT or from TOP.

 

I understand I have to work with the IF condition. I tried few times and didnt move forward.

Anyone to help me with that too? Please. =)

 

LISP

(defun c:w1 ()
 (setq dcl_id (load_dialog "w1_dcl.dcl"))
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 )
 (action_tile "LL" "(setq LW (distof $value))")
 (action_tile "HH" "(setq HW (distof $value))")
 (action_tile "OO" "(setq OW (distof $value))")

[i][b]; NOW THAT WONT MAKE ANY SENSE, BUT ITS PART OF ME TRYING[/b][/i]
[i][b]  (action_tile "SL" "(setq SL (getvar)")[/b][/i]
[i][b]  (action_tile "SR" "(setq SR (getvar)")[/b][/i]
[i][b]  (action_tile "ST" "(setq ST (getvar)")[/b][/i]

 (action_tile "accept" "(done_dialog 1)")
 (start_dialog)
 (unload_dialog dcl_id)
(defun dtr (x) (* pi (/ x 180.0)))
(defun w1_act ()
 (setq b1 (getpoint "\nPick Point: "))
 (setq b2 (polar B1 (dtr 90.0) HW))
 (setq b3 (polar b2 (dtr 0.0) LW))
 (setq b4 (polar B1 (dtr 0.0) LW))
 (setq bi1 (polar B1 (dtr 0.0) OW))
 (setq i1 (polar bi1 (dtr 90.0) OW))
 (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
 (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
 (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
 (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
 (setq is1 (polar i1 (dtr 0.0) OW))
 (setq s1 (polar is1 (dtr 90.0) OW))
 (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
 (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
 (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
 (command "._Layer" "M" "APL Frame" "C" "150" "" "")
 ; DRAWS THE MAIN FRAME
 (command
"PLine" B1 b2 b3 b4 "c"
"PLine" i1 i2 i3 i4 "c"
"PLine" B1 i1 ""
"PLine" b2 i2 ""
"PLine" b3 i3 ""
"PLine" b4 i4 ""
)
 ; DRAWS SASH TO LEFT - CONDITION TO VARIABLE "SL"
 (command
"PLine" s1 s2 s3 s4 "c"
"PLine" i4 SIL i3 ""
)
 ; DRAWS SASH TO RIGHT - CONDITION TO VARIABLE "SR"
 (command
"PLine" s1 s2 s3 s4 "c"
"PLine" i1 SIR i2 ""
)
 ; DRAWS SASH TO TOP - CONDITION TO VARIABLE "ST"
 (command
"PLine" s1 s2 s3 s4 "c"
"PLine" i1 SIT i4 ""
)


 (princ)
)
 (w1_act)
 (princ)
)

 

DCL

w1_dcl
: dialog

{

label = "SASHED 1 PANEL";
:row
{
:column
  {

: edit_box
{
label = "Lenght :";
mnemonic = "L";
key = "LL";
alignment = centered;
edit_limit = 5;
edit_width = 5;
}
 : edit_box
{
label = "Height :";
mnemonic = "H";
key = "HH";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: edit_box
{
label = "Frame :";
mnemonic = "O";
key = "OO";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "50";
}
: button{
key = "accept";
label = "Insert";
mnemonic = "I";
is_default = true;
fixed_width = true;
alignment = right;
}
  }

:column
  { 
:radio_button{label="Left";
key="SL";
}
:radio_button{label="Right";
key="SR";
}
:radio_button{label="Top";
key="ST";
}
: button{
key = "cancel";
label = "Cancel";
mnemonic = "C";
fixed_width = true;
alignment = right;
}
  }
}
}

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Rod PP

    12

  • pBe

    10

  • MSasu

    1

  • Stefan BMR

    1

Top Posters In This Topic

Posted Images

Posted

(action_tile "SL" "(setq SL[color=blue] $value[/color])")
 (action_tile "SR" "(setq SR [color=blue]$value[/color])")
 (action_tile "ST" "(setq ST [color=blue]$value[/color])")

 

 

  ; DRAWS SASH TO LEFT - CONDITION TO VARIABLE "SL"
[color=blue](cond[/color]
     [color=blue]((eq SL "1")[/color](command "PLine" s1 s2 s3 s4 "c"
   "PLine" i4 SIL i3 "")
   [color=blue])[/color]
 ; DRAWS SASH TO RIGHT - CONDITION TO VARIABLE "SR"
     [color=blue]((eq SR "1")[/color](command "PLine" s1 s2 s3 s4 "c"
  "PLine" i1 SIR i2 "")
   [color=blue])[/color]
 ; DRAWS SASH TO TOP - CONDITION TO VARIABLE "ST"
     [color=blue]((eq ST "1")[/color](command"PLine" s1 s2 s3 s4 "c"
  "PLine" i1 SIT i4 "")
  [color=blue])[/color]
     [color=blue])[/color]

Posted (edited)

I copied and Pasted to try first before I can understand everything.

But.. it didnt work.

I copied, pasted, saved the routine, loaded it again, and tried, didnt work.

=(

 

Im sorry, dont know what im doing wrong.

I even tried to add another cond (se user wants to mitre the corners)

 

check the whole code:

 

(defun c:w1 ()
 (setq dcl_id (load_dialog "w1_dcl.dcl"))
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 )
 (action_tile "LL" "(setq LW (distof $value))")
 (action_tile "HH" "(setq HW (distof $value))")
 (action_tile "OO" "(setq OW (distof $value))")
 (action_tile "SL" "(setq SL $value)")
 (action_tile "SR" "(setq SR $value)")
 (action_tile "ST" "(setq ST $value)")
 (action_tile "M" "(setq M $value)")
 (action_tile "accept" "(done_dialog 1)")
 (start_dialog)
 (unload_dialog dcl_id)
(defun dtr (x) (* pi (/ x 180.0)))
(defun w1_act ()
 (setq b1 (getpoint "\nPick Point: "))
 (setq b2 (polar B1 (dtr 90.0) HW))
 (setq b3 (polar b2 (dtr 0.0) LW))
 (setq b4 (polar B1 (dtr 0.0) LW))
 (setq bi1 (polar B1 (dtr 0.0) OW))
 (setq i1 (polar bi1 (dtr 90.0) OW))
 (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
 (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
 (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
 (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
 (setq is1 (polar i1 (dtr 0.0) OW))
 (setq s1 (polar is1 (dtr 90.0) OW))
 (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
 (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
 (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
 (command "._Layer" "M" "APL Frame" "C" "150" "" "")
 ; DRAWS THE MAIN FRAME
 (command
"PLine" B1 b2 b3 b4 "c"
"PLine" i1 i2 i3 i4 "c"
"PLine" s1 s2 s3 s4 "c"
)
(cond
 ((eq M "1")
 (command
  "PLine" B1 i1 ""
"PLine" b2 i2 ""
"PLine" b3 i3 ""
"PLine" b4 i4 ""
  ))
 )

 (cond

 ; DRAWS SASH TO LEFT
     (
     (eq SL "1")
     (command "PLine" i4 SIL i3 "")
     )
 ; DRAWS SASH TO RIGHT
     (
     (eq SR "1")
     (command "PLine" i1 SIR i2 "")
     )
 ; DRAWS SASH TO TOP
     (
     (eq ST "1")
     (command "PLine" i1 SIT i4 "")
     )
 )  
 (princ)
)
 (w1_act)
 (princ)
)

 

w1_dcl
: dialog

{

label = "SASHED 1 PANEL";
:row
{
:column
  {

: edit_box
{
label = "Lenght :";
mnemonic = "L";
key = "LL";
alignment = centered;
edit_limit = 5;
edit_width = 5;
}
 : edit_box
{
label = "Height :";
mnemonic = "H";
key = "HH";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: edit_box
{
label = "Frame :";
mnemonic = "O";
key = "OO";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "50";
}
: button{
key = "accept";
label = "Insert";
mnemonic = "I";
is_default = true;
fixed_width = true;
alignment = right;
}
  }
:column
  { 
:radio_button{label="Left";
key="SL";
}
:radio_button{label="Right";
key="SR";
}
:radio_button{label="Top";
key="ST";
}
: button{
key = "cancel";
label = "Cancel";
mnemonic = "C";
fixed_width = true;
alignment = right;
}
  }
}
      :toggle{
   key="M";
   label="Mitre corners";
   value="1";
   }
  

}

Edited by Rod PP
Posted

I hope you remember what you've learn on your previous thread?

 

Really Rod PP, How can it NOT work (assuming it works for you before the modification) when all i did is replace a couple of lines. :lol:

 

Try again dude. Trust me you need to understand how things work here.

Posted

pBe,

...dude... :) ... thanks for your being here.. but mann... it is not working. Dont know why.

Use the codes as per above, i have changed few things, adding new "cond" thing to the Mitre option as I said...

but...

the Mitre cant be drawn and it only draws the sash to the LEFT side. The others wont change a thing.

=(

 

 

Plus, if I press ESC, or Click Cancel, it doesnt work either, I just noticed it. I always have to Insert.

*sigh*

 

Dude.... Lol ... its my thrid day... not easy. hehe

Posted
pBe,

Use the codes as per above, i have changed few things, adding new "cond" thing to the Mitre option as I said...

but...

the Mitre cant be drawn and it only draws the sash to the LEFT side. The others wont change a thing.

=(

 

Is this what the final result supposed to look:

sampleRod.jpg

 

Plus, if I press ESC, or Click Cancel, it doesnt work either, I just noticed it. I always have to Insert.

*sigh*

 

You have not define an action for "cancel" key.

Posted

One other thing...

actually it works if I try something differet from LEFT from the beguining..

for example, if I insert a 1000x1000x50 TOP with Mitre.. it does draw it perfectly, Top, NO mitre corner.

Then I try to insert a 1000x1000x50 LEFT with Mitre .. it draws sometimes without the inner frame, sometimes without the outter frame, and always without Mitred corners, and then ALWAYS using LEFT.. once I use LEFT it doesnt change even if I chose TOP or RIGHT.

Does it make sense?

Sometimes the lines comes very very crazy.

 

See image below of crazy lines:

28638174.jpg

Uploaded with ImageShack.us

Posted

yes, thats how it should look like.. Lol.

 

I have tried to add a message here with an Image attached, but I need permission from Moderator to show it.

But well..

 

My results are not coming like yours.

=(

sometimes the inner frame doesnt draw

sometimes the outter frame doesnt draw

sometimes the lines come very crazy, not perpendicular to anything, joining points together.

The mitred corner never draws.

Posted (edited)

It does draw, my guess is you have active osnaps.

(setvar 'osmode 0)

 

Were you able to handle the "cancel" thingy?

 

(defun c:w1 ( / [color=blue]SL SR ST)[/color]
 (setq dcl_id (load_dialog "w1_dcl.dcl"))
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 )    
[color=blue] (set_tile "LL" (if (null LW) "0.00" (rtos LW 2 2)))[/color]
[color=blue] (set_tile "HH" (if (null HW) "0.00" (rtos HW 2 2)))[/color]
[color=blue] (set_tile "OO" (if (null OW) "0.00" (rtos OW 2 2)))    [/color]
 (action_tile "LL" "(setq LW (distof $value))")
 (action_tile "HH" "(setq HW (distof $value))")
 (action_tile "OO" "(setq OW (distof $value))")

; NOW THAT WONT MAKE ANY SENSE, BUT ITS PART OF ME TRYING
[color=blue] (action_tile "SL" "(setq SL $value)")[/color]
[color=blue] (action_tile "SR" "(setq SR $value)")[/color]
[color=blue] (action_tile "ST" "(setq ST $value)")[/color]

 (action_tile "accept" "[color=blue](setq pik T)[/color](done_dialog 1)")
[color=blue] (action_tile "cancel" "(setq pik nil)(done_dialog 0)")[/color]    
 (start_dialog)
 (unload_dialog dcl_id)
(defun dtr (x) (* pi (/ x 180.0)))
(defun w1_act ()
 (setq b1 (getpoint "\nPick Point: "))
 (setq b2 (polar B1 (dtr 90.0) HW))
 (setq b3 (polar b2 (dtr 0.0) LW))
 (setq b4 (polar B1 (dtr 0.0) LW))
 (setq bi1 (polar B1 (dtr 0.0) OW))
 (setq i1 (polar bi1 (dtr 90.0) OW))
 (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
 (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
 (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
 (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
 (setq is1 (polar i1 (dtr 0.0) OW))
 (setq s1 (polar is1 (dtr 90.0) OW))
 (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
 (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
 (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
[color=blue] (setvar 'osmode 0)[/color]    
 (command "._Layer" "M" "APL Frame" "C" "150" "" "")
 ; DRAWS THE MAIN FRAME
 (command
"PLine" B1 b2 b3 b4 "c"
"PLine" i1 i2 i3 i4 "c"
"PLine" B1 i1 ""
"PLine" b2 i2 ""
"PLine" b3 i3 ""
"PLine" b4 i4 ""
)
[color=blue](cond[/color]
; DRAWS SASH TO RIGHT - CONDITION TO VARIABLE "Sl"      
    [color=blue]((eq SL "1")[/color]
      (command "PLine" s1  s2 s3 s4 "c"
            "PLine" i4  SIL i3 "")[color=blue])[/color]
     [color=blue]((eq SR "1")[/color]
      (command "PLine" s1 s2  s3 s4 "c"
            "PLine" i1  SIR i2 "")[color=blue])[/color]
; DRAWS SASH TO TOP - CONDITION TO VARIABLE "ST"
   [color=blue]  ((eq ST "1")[/color]
      (command "PLine"  s1  s2  s3  s4 "c"
            "PLine" i1  SIT i4 "")[color=blue])[/color]
[color=blue]     )[/color]
 (princ)
)
[color=blue] (if pik [/color](w1_act)[color=blue])[/color]
 (princ)
)

 

w1_dcl
: dialog {
label = "SASHED 1 PANEL";
:row
{
:column
  {
: edit_box {
label = "Lenght :"; mnemonic = "L"; key = "LL"; alignment = centered;
 edit_limit = 5; edit_width = 5; [color=blue]value = "";[/color]
}
 : edit_box { label = "Height :"; mnemonic = "H"; key = "HH"; alignment = centered;
 edit_limit = 5; edit_width = 5; [color=blue]value = "";[/color]
}
: edit_box {
label = "Frame :"; mnemonic = "O"; key = "OO"; alignment = centered;
edit_limit = 5; edit_width = 5;[color=blue] value = "";[/color]
}
: button{ key = "accept"; label = "Insert"; mnemonic = "I"; is_default = true;
 fixed_width = true; alignment = right;
}
  }

:column {
:radio_button{label="Left"; key="SL";}
:radio_button{label="Right"; key="SR";}
:radio_button{label="Top"; key="ST";}
: button{
key = "cancel"; label = "&Cancel"; mnemonic = "C";
fixed_width = true; alignment = right; [color=blue]is_cancel = true;[/color]
}
  }
}
}

Edited by pBe
Posted

Im useless! hehe

I have added the osmode as you suggested above.

 

Ok, the Cancel thingy.. nope. Didnt try that yet to be honest.

 

The very first time I try to insert after loading the AutoCAD and Loading the routine.. nothing works, the DCL comes fine, the the routine doesnt run, if I try again, then it works.

 

The Left, Right, Top options... it works if I dont use Left as first option. Once I chose Left, all the others can only draw in Left option.

 

The Mitre is still not working.

Posted

Rod PP

I tried your last version and I recommend this:

- at the very beginning, add

(setq OW 50 M "1")

- modify your code for SL, SR and ST variable:

  (action_tile "SL" "(setq SL t   SR nil ST nil)")
 (action_tile "SR" "(setq SL nil SR t   ST nil)")
 (action_tile "ST" "(setq SL nil SR nil ST t  )")

- last (cond.. should be

(cond
 ; DRAWS SASH TO LEFT
     (SL (command "PLine" i4 SIL i3 ""))
 ; DRAWS SASH TO RIGHT
     (SR (command "PLine" i1 SIR i2 ""))
 ; DRAWS SASH TO TOP
     (ST (command "PLine" i1 SIT i4 ""))
 )

And of course, add the 'OSMODE and Error stuff.

Posted (edited)
Im useless! hehe

I have added the osmode as you suggested above.

 

No you're not, just confuse thats all.

Did you try Sterfans' suggestion? You're original code works fine here (along with the mods).

 

Oh well. Holler if you need hekp ;) [see post #8]

Edited by pBe
Posted

Stefan BMR

 

Thanks for your help too.

 

Well,

trully everyone, it's still not working, hehehe.

Gosh..

 

this is what I am doing and what is happening,

step by step:

 

Load AutoCAD;

Load routine;

Type W1 to run routine;

DCL loads perfectly;

I chose 1000, 1000 and 50 as value to the Edit box;

I mark Left;

Leave Mitre checked;

I click Insert;

 

when chosing the point, for the very very first time, it will always return that:

Pick Point: ; error: bad argument type: numberp: nil

 

Then I try again...

 

I don't close AutoCAD or restart a new file, I leave as it is;

I don't even re-load the routine;

I simply type W1 and repeat all the steps above;

Now it finallys does insert the window, but...

No lines to the Mitre and No lines defining the sash opening side;

 

I try again, still without re-loading routine;

 

W1;

Chose same values 1000, 1000, 50;

Change to Right option; checked;

Mitre checked;

Insert;

 

Then it draws me the window,

No mitre at corners,

It does draw the Sash to the Right.

 

I try again, repeating everything, but changing to Top;

it works fine, draws, top perfect, but...

No Mitred corners.

 

I try again back to Left option:

It still draws the window Without the Mitre, and still pointing to Top.

 

I try again:

1000, 1000, 50, Left, Mitred.

It does draw perfectly, to the left, but still no Mitred corner.

 

 

.....

So.. it is very weird, chosing or not chosing Left, Right, Top.. most of the times it doesnt follow what I chose, it keeps drawing whatever was on "memory" I suppose.

The Mitred option doesnt work.

 

I cant set the OW to 50, or Mitre to 1, because the User is who will decide that, so if I leave to 50, for example, I wont be able to draw a window with 80, or 100 frame facing.

=/

Posted

pBe,

 

=)

 

dude...

I copied and replaced my LISP code with yours,

and modified the DCL with the blues you marked,

....but it is coming with the following error:

 

(after re-loading routine)

 

Command: w1
; error: quit / exit abort

Posted
pBe,

 

=)

 

dude...

I copied and replaced my LISP code with yours,

and modified the DCL with the blues you marked,

....but it is coming with the following error:

 

(after re-loading routine)

 

Command: w1
; error: quit / exit abort

 

My bad

 

I put an extra "W" there during testing

(setq dcl_id (load_dialog "[color=blue]w[/color]w1_dcl.dcl"))

should be

(setq dcl_id (load_dialog "w1_dcl.dcl"))<------

Posted

That error most probably comes from EXIT function – seems that the DCL file isn’t places on support files search path. To fix it you move the DCL on one of said folders, add the current location in search paths list (OPTIONS) or add the path to DCL call:

 

 (setq dcl_id (load_dialog "[color=red]C:\\MyLispTools\\[/color]w1_dcl.dcl"))

Posted
That error most probably comes from EXIT function – seems that the DCL file isn’t places on support files search path. To fix it you move the DCL on one of said folders, add the current location in search paths list (OPTIONS) or add the path to DCL call:

 

Yeah, maybe that too :)

Posted

MSasu - Thanks, but the files are located properly on support files search path... =/

 

pBe - Thanks once again. =)

 

...

 

Hey you all, I am sorry I couldnt reply that before, only now am having a chance to play with AutoLISP and see what happens...

So, I have tried to reload this sample, and have modified the extra W as stated by pBe, and it is working fine.

But...............

yeah... (there is a But) ....but... Lol ..

I decided to change few things, add others, and now its not working.. hehe

thats the message it is coming up with:

 

too few arguments: (IF ((EQ M "1") (COMMAND "Color" "250" "" "PLine" B1 I1 "" 
"PLine" B2 I2 "" "PLine" B3 I3 "" "PLine" B4 I4 "")))

 

Just to clarify, those are the CODES I am using now:

 

(defun c:w1 ( / SL SR ST)
 (setq dcl_id (load_dialog "w1_dcl.dcl"))
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 )    
 (set_tile "LL" (if (null LW) "0.00" (rtos LW 2 2)))
 (set_tile "HH" (if (null HW) "0.00" (rtos HW 2 2)))
 (set_tile "OO" (if (null OW) "50.0" (rtos OW 2 2)))    
 (action_tile "LL" "(setq LW (distof $value))")
 (action_tile "HH" "(setq HW (distof $value))")
 (action_tile "OO" "(setq OW (distof $value))")
 (action_tile "SL" "(setq SL $value)")
 (action_tile "SR" "(setq SR $value)")
 (action_tile "ST" "(setq ST $value)")
 (action_tile "M" "(setq M $value)")

 (action_tile "accept" "(setq pik T)(done_dialog 1)")
 (action_tile "cancel" "(setq pik nil)(done_dialog 0)")

 (start_dialog)
 (unload_dialog dcl_id)
(defun dtr (x) (* pi (/ x 180.0)))
(defun w1_act ()
 (setq b1 (getpoint "\nPick Point: "))
 (setq b2 (polar B1 (dtr 90.0) HW))
 (setq b3 (polar b2 (dtr 0.0) LW))
 (setq b4 (polar B1 (dtr 0.0) LW))
 (setq bi1 (polar B1 (dtr 0.0) OW))
 (setq i1 (polar bi1 (dtr 90.0) OW))
 (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
 (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
 (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
 (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
 (setq is1 (polar i1 (dtr 0.0) OW))
 (setq s1 (polar is1 (dtr 90.0) OW))
 (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
 (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
 (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
 (setvar 'osmode 0)
 (setq LtH1 "Hidden")
 (if (= (tblsearch "ltype" LtH1) nil)
   (command "-linetype" "l" LtH1 "acadiso.lin" "")
   (princ))
 (setq LyF1 "APL Frame")
 (if (= (tblsearch "layer" LyF1) nil)
   (command "._Layer" "M" "APL Frame" "C" "140" "")
   (princ))
 ; DRAWS THE MAIN FRAME
 (command
"PLine" B1 b2 b3 b4 "c"
"Color" "8" ""
"PLine" i1 i2 i3 i4 "c"
)
; DRAWS the Mitre
 (IF
   ((eq M "1")
    (command
      "Color" "250" ""
      "PLine" B1 i1 ""
      "PLine" b2 i2 ""
      "PLine" b3 i3 ""
      "PLine" b4 i4 ""
      ))
      )

; DRAWS SASH TO RIGHT
   (IF
     ((eq SL "1")
      (command
 "Color" "250" ""
 "PLine" s1 s2 s3 s4 "c"
 "-Linetype" LtH1 "20" ""
 "PLine" i4 SIL i3 ""
 ))
      )

; DRAWS SASH TO LEFT
 (IF
   ((eq SR "1")
    (command
      "Color" "250" ""
      "PLine" s1 s2 s3 s4 "c"
      "-Linetype" LtH1 "20" ""
      "PLine" i1 SIR i2 ""
      ))
    )

; DRAWS SASH TO TOP
 (IF
   ((eq ST "1")
      (command
 "Color" "250" ""
 "PLine" s1 s2 s3 s4 "c"
 "-Linetype" LtH1 "20" ""
        "PLine" i1 SIT i4 ""
 ))
    )



 ; Am not sure about that...
 (command
   "Ltype" "ByLayer" ""
   "Color" "ByLayer" ""
   )

 (princ)
)
 (if pik (w1_act))
 (princ)
)

 

w1_dcl
: dialog

{

label = "1 PANEL";
:row{

:column{

: edit_box{label = "Lenght :";
mnemonic = "L";
key = "LL";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value="";
}
 : edit_box{label = "Height :";
mnemonic = "H";
key = "HH";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: edit_box{label = "Frame :";
mnemonic = "O";
key = "OO";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: button{
key = "accept";
label = "Insert";
mnemonic = "I";
is_default = true;
fixed_width = true;
alignment = right;
}
: button{
key = "cancel";
label = "Cancel";
mnemonic = "C";
fixed_width = true;
alignment = right;
}

} //column
:column{

      :radio_button{label="Fixed Panel";
   key="F";
   value="1";
   }
   :radio_button{label="Left";
key="SL";
}
:radio_button{label="Right";
key="SR";
}
:radio_button{label="Top";
key="ST";
}

   :toggle{label="Mitre corners";
   key="M";
   value="1";}
     } //column
  } //row
   is_cancel = true;

} //dcl

Posted

Ok.. i swear I am trying, but really not moving forward.

:cry:

 

I know its a lot I am asking, so only if somone doesnt mind at all helping me with that, teaching me, I really would like to learn it.

 

This is the new message showing up when I try to use routine:

 

Command: w1
Pick Point: _layer
Current layer:  "0"
Enter an option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _M
Enter name for new layer (becomes the current layer) <0>: APL frame Enter an 
option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
New color [Truecolor/COlorbook] : 140
Enter name list of layer(s) for color 140 <APL frame>: Enter an option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre
eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]:
Command: _Linetype
Current line type:  "ByLayer"
Enter an option [?/Create/Load/Set]: L
Enter linetype(s) to load: Hidden Enter name of linetype file to search 
<C:\Users\Rod\AppData\Roaming\Autodesk\AutoCAD 2012 - 
English\R18.2\enu\Support\acadiso.lin>:
Linetype "HIDDEN" loaded.
Enter an option [?/Create/Load/Set]:
Command: PLine
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c
Command: Color
Enter default object color [Truecolor/COlorbook] <BYLAYER>: 8
[b][u]Command: W1 Unknown command "W1".  Press F1 for help.[/u][/b]
Command: PLine
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: c
Command: _Linetype
Current line type:  "ByLayer"
[b][u]Enter an option [?/Create/Load/Set]: ByLayer[/u][/b]
[b][u]Invalid option keyword.[/u][/b]
[b][u]; error: Function cancelled[/u][/b]
[b][u]Enter an option [?/Create/Load/Set]:[/u][/b]

 

So, it has something to do with the Layers, and linetypes but I cant find the problem at all.

 

The NEW codes Im using after trying to change and change:

 

(defun c:w1 ( / SL SR ST)
 (setq dcl_id (load_dialog "w1_dcl.dcl"))
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 )    
 (set_tile "LL" (if (null LW) "" (rtos LW 2 2)))
 (set_tile "HH" (if (null HW) "" (rtos HW 2 2)))
 (set_tile "OO" (if (null OW) "" (rtos OW 2 2)))    
 (action_tile "LL" "(setq LW (distof $value))")
 (action_tile "HH" "(setq HW (distof $value))")
 (action_tile "OO" "(setq OW (distof $value))")
 (action_tile "SL" "(setq SL $value)")
 (action_tile "SR" "(setq SR $value)")
 (action_tile "ST" "(setq ST $value)")
 (action_tile "M" "(setq M $value)")

 (action_tile "accept" "(setq pik T)(done_dialog 1)")
 (action_tile "cancel" "(setq pik nil)(done_dialog 0)")

 (start_dialog)
 (unload_dialog dcl_id)
(defun dtr (x) (* pi (/ x 180.0)))
(defun w1_act ()
 (setq b1 (getpoint "\nPick Point: "))
 (setq b2 (polar B1 (dtr 90.0) HW))
 (setq b3 (polar b2 (dtr 0.0) LW))
 (setq b4 (polar B1 (dtr 0.0) LW))
 (setq bi1 (polar B1 (dtr 0.0) OW))
 (setq i1 (polar bi1 (dtr 90.0) OW))
 (setq i2 (polar i1 (dtr 90.0) (- HW (* 2 OW))))
 (setq i3 (polar i2 (dtr 0.0) (- LW (* 2 OW))))
 (setq i4 (polar i1 (dtr 0.0) (- LW (* 2 OW))))
 (setq SIL (polar i1 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIR (polar i4 (dtr 90.0) (- (/ HW 2) OW)))
 (setq SIT (polar i2 (dtr 0.0) (- (/ LW 2) OW)))
 (setq is1 (polar i1 (dtr 0.0) OW))
 (setq s1 (polar is1 (dtr 90.0) OW))
 (setq s2 (polar s1 (dtr 90.0) (- HW (* 4 OW))))
 (setq s3 (polar s2 (dtr 0.0) (- LW (* 4 OW))))
 (setq s4 (polar s1 (dtr 0.0) (- LW (* 4 OW))))
 (setvar 'osmode 0)
; Am trying to create Layer and Ltype
 (command "_layer"
   "_M" "APL frame" "_C" "140" "" ""
   "_Linetype" "L" "Hidden" "" ""
   )

; DRAWS THE MAIN FRAME
 (command
   "PLine" B1 b2 b3 b4 "c"
   "Color" "8" ""
   "PLine" i1 i2 i3 i4 "c"
   )
; DRAWS the Mitre
 (IF(= M 1)
    (command
      "Color" "250" ""
      "PLine" B1 i1 ""
      "PLine" b2 i2 ""
      "PLine" b3 i3 ""
      "PLine" b4 i4 ""
     )(princ)
   )

; DRAWS SASH TO RIGHT
   (COND
     ((eq SL "1")
      (command
 "Color" "250" ""
 "PLine" s1 s2 s3 s4 "c"
 ; Here am trying to make Sashes with Hidden Ltype
 "_Linetype" "Hidden" "20"
       "PLine" i4 SIL i3 ""
 ))(princ)
      )

; DRAWS SASH TO LEFT
 (COND
   ((eq SR "1")
    (command
      "Color" "250" ""
      "PLine" s1 s2 s3 s4 "c"
        ; Here am trying to make Sashes with Hidden Ltype
 "_Linetype" "Hidden" "20"
      "PLine" i1 SIR i2 ""
      ))(princ)
    )

; DRAWS SASH TO TOP
 (COND
   ((eq ST "1")
      (command
 "Color" "250" ""
 "PLine" s1 s2 s3 s4 "c"
 ; Here am trying to make Sashes with Hidden Ltype
 "_Linetype" "Hidden" "20"
        "PLine" i1 SIT i4 ""
 ))(princ)
    )

 ; Am not sure about that...
 (command
   "_Linetype" "ByLayer" ""
   "_Color" "ByLayer" ""
   )

 (princ)
)
 (if pik (w1_act))
 (princ)
)

 

w1_dcl
: dialog

{

label = "1 PANEL";
:row{ //ROW A

:column{ //COLUMN A
label="Dimensions";

: edit_box{label = "Lenght :";
key = "LL";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value="";
}
 : edit_box{label = "Height :";
key = "HH";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: edit_box{label = "Frame :";
key = "OO";
alignment = centered;
edit_limit = 5;
edit_width = 5;
value = "";
}
: button{
key = "accept";
label = "Insert";
mnemonic = "I";
is_default = true;
fixed_width = true;
alignment = right;
}
: button{
key = "cancel";
label = "Cancel";
mnemonic = "C";
fixed_width = true;
alignment = right;
}

} //column A
:column{ // COLUMN B
label="Type";

      :radio_button{label="Fixed Panel";
   key="F";
   value="1";
   }
   :radio_button{label="Left";
key="SL";
}
:radio_button{label="Right";
key="SR";
}
:radio_button{label="Top";
key="ST";
}

   :toggle{label="Mitre corners";
   key="M";
   value="1";}
     } //column B
  } //row A
   is_cancel = true;

} //dcl

Posted

Since you are now using the cond function, you are not limited with just one line. dont squeeze three coomands in one line

 

 ((eq ST "1") (command "Color" "250" "" "PLine" s1 s2 s3 s4 "c" "_Linetype" "Hidden" "[b]20"[/b]
        "PLine" i1 SIT i4 "")

 

You might as well separate these to

((eq ST "1")
(command "Color" "250")
(command "PLine" s1 s2 s3 s4 "c")
(command "_Linetype" "Hidden")
(command "PLine" i1 SIR i2 ""))

 

Not sure what "20" on your command line is for though.

Also why use this:

(COND
   ((eq SL "1") (command ... ))(princ))
(COND
   ((eq SR "1")(command ... ))(princ))
(COND
   ((eq ST "1") (command ...  ))(princ))

When it should be this

(COND
   ((eq SL "1")  (command ... ))
   ((eq SR "1") (command ... ))
   ((eq ST "1") (command ... ))
   )

 

Tell us what would be the final result will look after your modification, so we may understand it better.

 

Look into this system variables

 (setvar [b]'CeColor[/b] "256")(setvar [b]'CeLtype[/b] "Bylayer")(setvar '[b]CeLtScale[/b] 20)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...