Jump to content

Recommended Posts

Posted

Hey, thanks a lot for your attention..

 

so.. the number "20" is supposed to be the scale for the Hidden linetypes.

Im always trying to insert using 1000 x 1000 x 50 (for example), so the 20 as scale to the Sashes line is what I would use.

 

So..

the "window" should look like:

 

0. All in ONE layer only! (APL WS, for example);

1. outter rectangle = blueish colour, continuous line;

2. second rectangle = colour 8, continuous line;

 

...if not fixed panel, Conditions apply = if Left/Right/Top sashes, then ...

 

3. third rectangle colour 250, continuous line;

4. Sashes lines (V shape), to Left/Right/Top on colour 250, Hidden line;

5. Mitre lines (one line at each corener), colour 250, continuous line;

 

So, different explanation ...

 

the window is composed by

3 rectangles, all in the same layer

 

first rect. colour blueish

second rect. colour 8

third rect. colour 250

 

The third rect. is part of the Left/Right/Top condition.

 

If none of the condition above is selected, it means the option "Fixed Panel" was selected, so the third rectangle wouldnt appear.

 

If one of those options is selected, then it will draw that third rectangle, plus the "V" shape which determines to each side the window opens (left, right or top).

This "V" shape Pline would be using the same Layer, but colour 250 and Hidden lines.

 

Mitre option, is optional, thats why i chose Toggle, so the user can chose to add or not.

 

this is the modified code, trying to join the COND as you told me to.

 

(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 0)))
 (set_tile "HH" (if (null HW) "" (rtos HW 2 0)))
 (set_tile "OO" (if (null OW) "" (rtos OW 2 0)))    
 (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)
; 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)
   )
 (COND
     ; DRAWS SASH TO RIGHT
     ((eq SL "1")
      (command "Color" "250")
      (command "PLine" s1 s2 s3 s4 "c")
; these next lines should be Hidden, scale 20
      (command "PLine" i4 SIL i3 "")
      (princ)
      )
     ; DRAWS SASH TO LEFT
     ((eq SR "1")
      (command "Color" "250")
      (command "PLine" s1 s2 s3 s4 "c")
      ; these next lines should be Hidden, scale 20
      (command "PLine" i1 SIR i2 "")
      (princ)
      )
     ; DRAWS SASH TO TOP
     ((eq ST "1")
      (command "Color" "250")
      (command "PLine" s1 s2 s3 s4 "c")
      ; these next lines should be Hidden, scale 20
      (command "PLine" i1 SIT i4 "")
      (princ)
      )
     ) ; Cond

 ; Am not sure about that, just trying to keep Color and Ltype BYLAYER...
 (command
   "_Linetype" "ByLayer" ""
   "_Color" "ByLayer" ""
   )

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

  • 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

(defun c:w1 ( /  _Draw  SL SR ST [b][color=blue]M[/color][/b])
[color=blue](vl-load-com)      [/color]
[color=blue](defun _Draw (var v1 v2 lst)[/color]
[color=blue]   (command "PLine")[/color]
[color=blue]    (foreach p lst[/color]
[color=blue]           (command p))(command "c")[/color]
[color=blue]   (mapcar '(lambda (x y)(setvar x y))[/color]
[color=blue]                  '("CECOLOR" "CELTYPE" "CELTSCALE")[/color]
[color=blue]                  '("250" "HIDDEN" 20))[/color]
[color=blue]   (command "PLine" v1 var v2 "")[/color]
[color=blue]   )      [/color]
[color=blue](if (not (tblsearch "LTYPE" "HIDDEN"))[/color]
[color=blue](vla-load (vla-get-Linetypes (vla-get-ActiveDocument (vlax-get-acad-object)))[/color]
[color=blue]         "HIDDEN"[/color]
[color=blue]         (cond ((= (getvar "Measurement") 0) "ACAD.LIN")[/color]
[color=blue]               ("ACADISO.LIN"))))[/color]
[color=blue](setq M "1")    [/color]
[color=black](setq dcl_id (load_dialog "w1_dcl.dcl"))[/color]
 (if (not (new_dialog "w1_dcl" dcl_id))
   (exit)
 ).....
...
(IF ([color=blue]eq[/color] M "1")
    (command
      "Color" "250" ""
      "PLine" B1 i1 ""
      "PLine" b2 i2 ""
      "PLine" b3 i3 ""
      "PLine" b4 i4 ""
     )(princ)
   )
 [color=blue](cond[/color]
[color=blue]   ; DRAWS SASH TO RIGHT[/color]
[color=blue]   ((eq SL "1")(_draw SIL i4 i3 (list s1 s2 s3 s4)))[/color]
[color=blue]   ; DRAWS SASH TO LEFT[/color]
[color=blue]   ((eq SR "1")(_draw SIR i1 i2 (list s1 s2 s3 s4)))[/color]
[color=blue]   ; DRAWS SASH TO TOP[/color]
[color=blue]   ((eq ST "1")(_draw SIT i1 i4 (list s1 s2 s3 s4)))[/color]
[color=blue]   )[/color] ; Cond

[color=blue](mapcar '(lambda (x y)(setvar x y))[/color]
[color=blue]                  '("CECOLOR" "CELTYPE")[/color]
[color=blue]                  '("256" "BYLAYER"))[/color]
 (princ)
)
 (if pik (w1_act))
 (princ)
)
  

...
} //column B
  } //row A
  [color=darkolivegreen]is_cancel = true;//<-- not here[/color]
[color=darkolivegreen]...[/color]
: button {
key = "cancel";
label = "Cancel";
mnemonic = "C";
fixed_width = true;
alignment = right;
[color=blue]is_cancel = true; //<--- here[/color]
}
....

 

I would suggest that you learn about Error handling. that way you can set osnaps and other system variables.

I bit of light reading for you ---> Error_Handling_LM

 

HTH

Posted

Geeeeee... Lol..

i will spend a month trying to understand you you have just done above...

Lol ....

ok, lets restart, what is LISP? Lol. Where am I?

 

ok, I believe it will take a little while til i come back after trying few other things.

 

Thanks dude.

Posted
Geeeeee... Lol..

i will spend a month trying to understand you you have just done above...

Lol ....

ok, lets restart, what is LISP? Lol. Where am I?

 

ok, I believe it will take a little while til i come back after trying few other things.

 

Thanks dude.

 

No problem. I just build over the code and not deviate from that of what you started. Its all you Rod PP. And read up on that link i posted for Error Handling.

 

Keep on coding :thumbsup:

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...