Author Topic: How would you array this horizotally  (Read 7620 times)

0 Members and 2 Guests are viewing this topic.

One Shot

  • Guest
How would you array this horizotally
« on: May 08, 2008, 02:17:23 PM »
How would you get this to array horizontally to have a choice of a overhange of a window opening of (0" & 3 3/16") at Top Left and Top Right corner of a opening.  Plus have the Joint adjust between 1/4" to no more than 1/2" to work equally?

This code is a test Soldier Course.  This is the easist to do first.

Code: [Select]
(defun C:SC-Test()         
         
          (setq oldsnap (getvar "osmode"))
          (setvar "osmode" 0)
          (setq oldblip (getvar "blipmode"))
          (setvar "blipmode" 0)
          (setq width 3.625)
          (setq height 7.250)
          (setq cheight 7.625)
          (setq jt 0.375)
          (setq pt1 (getpoint "\nPick point top left corrner of opening: "))
          (setvar "osmode" 0)   
          (setq pt2 (polar pt1 0 width))
          (setq pt3 (polar pt2 (* pi 0.5) height))
          (setq pt4 (polar pt3 pi width))
          (command "pline" pt1 pt2 pt3 pt4 pt1 "")
          (setq br (entlast))


Thank you for you help with this.

Brad

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How would you array this horizotally
« Reply #1 on: May 08, 2008, 05:47:13 PM »
Brad,
How about a picture or a DWG to go with your explanation?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Re: How would you array this horizotally
« Reply #2 on: May 08, 2008, 07:02:57 PM »
Sorry about that that.  I had this at home when I posted this thread today.

Adesu

  • Guest
Re: How would you array this horizotally
« Reply #3 on: May 08, 2008, 09:43:51 PM »
Hi Brad,
Do you mean like this
Code: [Select]
(defun C:SC-Test(/ br cheight height jt oldsnap pt1 pt2 pt3 pt4 width)
  (setq oldsnap (getvar "osmode"))
  (setvar "osmode" 0)
  (setq oldsnap (getvar "blipmode"))
  (setvar "blipmode" 0)
  (setq width 3.625)
  (setq height 7.250)
  (setq cheight 7.625)
  (setq jt 0.375)
  (setq pt1 (getpoint "\nPick point top left corrner of opening: "))
  (setvar "osmode" 0)
  (setq pt2 (polar pt1 0 width))
  (setq pt3 (polar pt2 (* pi 0.5) height))
  (setq pt4 (polar pt3 pi width))
  (command "pline" pt1 pt2 pt3 pt4 pt1 "")
  (setq br (entlast))
  (command "_array" br "" "r" 1 10 4 "")
  (setvar "osmode" oldsnap)
  (setvar "blipmode" oldsnap)
  (princ)
  ) ; defun 

How would you get this to array horizontally to have a choice of a overhange of a window opening of (0" & 3 3/16") at Top Left and Top Right corner of a opening.  Plus have the Joint adjust between 1/4" to no more than 1/2" to work equally?

This code is a test Soldier Course.  This is the easist to do first.

Code: [Select]
(defun C:SC-Test()         
         
          (setq oldsnap (getvar "osmode"))
          (setvar "osmode" 0)
          (setq oldblip (getvar "blipmode"))
          (setvar "blipmode" 0)
          (setq width 3.625)
          (setq height 7.250)
          (setq cheight 7.625)
          (setq jt 0.375)
          (setq pt1 (getpoint "\nPick point top left corrner of opening: "))
          (setvar "osmode" 0)   
          (setq pt2 (polar pt1 0 width))
          (setq pt3 (polar pt2 (* pi 0.5) height))
          (setq pt4 (polar pt3 pi width))
          (command "pline" pt1 pt2 pt3 pt4 pt1 "")
          (setq br (entlast))


Thank you for you help with this.

Brad

One Shot

  • Guest
Re: How would you array this horizotally
« Reply #4 on: May 08, 2008, 10:13:01 PM »
Hi Adesu,

Thank you for that.  Did you by chance look at the drawing file that is attached to this thread?  Tomorrow I will be working on the other pick point so that I could pick another point and the brick continues to that point.  I will be also working on the Mortar joint also.

Thank you very much for the help.

Brad

Hi Brad,
Do you mean like this
Code: [Select]
(defun C:SC-Test(/ br cheight height jt oldsnap pt1 pt2 pt3 pt4 width)
  (setq oldsnap (getvar "osmode"))
  (setvar "osmode" 0)
  (setq oldsnap (getvar "blipmode"))
  (setvar "blipmode" 0)
  (setq width 3.625)
  (setq height 7.250)
  (setq cheight 7.625)
  (setq jt 0.375)
  (setq pt1 (getpoint "\nPick point top left corrner of opening: "))
  (setvar "osmode" 0)
  (setq pt2 (polar pt1 0 width))
  (setq pt3 (polar pt2 (* pi 0.5) height))
  (setq pt4 (polar pt3 pi width))
  (command "pline" pt1 pt2 pt3 pt4 pt1 "")
  (setq br (entlast))
  (command "_array" br "" "r" 1 10 4 "")
  (setvar "osmode" oldsnap)
  (setvar "blipmode" oldsnap)
  (princ)
  ) ; defun 

How would you get this to array horizontally to have a choice of a overhange of a window opening of (0" & 3 3/16") at Top Left and Top Right corner of a opening.  Plus have the Joint adjust between 1/4" to no more than 1/2" to work equally?

This code is a test Soldier Course.  This is the easist to do first.

Code: [Select]
(defun C:SC-Test()         
         
          (setq oldsnap (getvar "osmode"))
          (setvar "osmode" 0)
          (setq oldblip (getvar "blipmode"))
          (setvar "blipmode" 0)
          (setq width 3.625)
          (setq height 7.250)
          (setq cheight 7.625)
          (setq jt 0.375)
          (setq pt1 (getpoint "\nPick point top left corrner of opening: "))
          (setvar "osmode" 0)   
          (setq pt2 (polar pt1 0 width))
          (setq pt3 (polar pt2 (* pi 0.5) height))
          (setq pt4 (polar pt3 pi width))
          (command "pline" pt1 pt2 pt3 pt4 pt1 "")
          (setq br (entlast))


Thank you for you help with this.

Brad

Fatty

  • Guest
Re: How would you array this horizotally
« Reply #5 on: May 09, 2008, 06:40:12 AM »
I have just a few minutes to write the code,
follow this way further :-)

Code: [Select]
            (defun C:SC-Test  (/ cheight cpt gpt1 gpt2 gpt3 gpt4 height jt num
         oldblip oldsnap pt1 pt2 pt3 pt4 ss step width)
    (setvar "cmdecho" 0)
    (setq oldsnap (getvar "osmode"))
    (setvar "osmode" 0)
    (setq oldblip (getvar "blipmode"))
    (setvar "blipmode" 0)
    (setq width 3.625)
    (setq height 7.250)
    (setq cheight 3.625);<-- change to suit
    (setq jt 0.375)
    (setq pt1 (getpoint "\nPick point top left corner of opening: "))
    (setq pt2 (polar pt1 0 width))
    (setq pt3 (polar pt2 (* pi 0.5) height))
    (setq pt4 (polar pt3 pi width))
    (command "pline")
    (apply 'command (list pt1 pt2 pt3 pt4 pt1))
    (command "CL") ;<--closed pline
    (command "extrude" "L" "" cheight)
    (setq step (+ jt width))
    (setq num (getint "\nNumber of bricks in the row: "))
    (command "-array" (ssget "L") "" "R" 1 num step)
    (setq gpt1 pt2
  gpt2 (list (car gpt1) (- (cadr gpt1) width) (caddr pt1))
  gpt3 (list (+ (car gpt2) jt) (cadr gpt2) (caddr pt1))
  gpt4 (list (car gpt3) (cadr gpt1) (caddr pt1))
  cpt  (list (+ (car gpt2) (/ jt 2.0)) (cadr gpt2) (caddr pt1))
  )
    (command "pline")
    (apply 'command (list gpt3 gpt4 gpt1 gpt2))
    (command) ;<--opened pline
    (setq ss (ssadd))
    (ssadd (entlast) ss)
    (command "arc" "C" "none" cpt "none" gpt3 "none" gpt2)
    (ssadd (entlast) ss)
    (setvar "peditaccept" 1)
    (command "pedit" "m" ss "" "J" "" "" "")
    (if (not (arxload "geom3d.arx"))
        (arxload "geom3d.arx")
      )
    (command "extrude" "L" "" height)
    (command "rotate3D" "L" "" "X" gpt1 -90.0)
    (arxunload "geom3d.arx")
    (command "-array" (ssget "L") "" "R" 1 (1- num) step)
    (setvar "osmode" oldsnap)
    (setvar "blipmode" oldblip)
    (setvar "cmdecho" 1)
    (princ)
    )

~'J'~

One Shot

  • Guest
Re: How would you array this horizotally
« Reply #6 on: May 09, 2008, 10:41:17 AM »
How did I do with this.  I got an error message.

Code: [Select]
(defun C:SCJT-Test(/ jt jheight height oldsnap jpt1 jpt2 jpt3 jpt4 jpt5 jpt6 jpt7 jpt8 jpt9 jpt10 jpt11 jpt12 width)
  (setq oldsnap (getvar "osmode"))
  (setvar "osmode" 0)
  (setq oldsnap (getvar "blipmode"))
  (setvar "blipmode" 0)
  (setq width 0.375)
  (setq jheight 7.625)
  (setq jt 0.375)
  (setq jjpt1 (getpoint "\nPick point top left corrner of opening: "))
  (setvar "osmode" 0)
  (setq jpt2 (polar jpt1 0 width))
  (setq jpt3 (polar jpt2 (* pi 0.5) height))
  (setq jpt4 (polar jpt3 pi width))
  (setq jpt5 (polar jpt4 pi width))
  (setq jpt6 (polar jpt5 (* pi 0.5) height))
  (setq jpt7 (polar jpt6 pi width))
  (setq jpt8 (polar jpt7 pi width))
  (setq jpt9 (polar jpt8 (* pi 0.5) height))
  (setq jpt10(polar jpt9 pi width))
  (setq jpt11(polar jpt10 (* pi 0.5) height))
  (setq jpt12(polar jpt11 pi width))
  (command "pline" jpt1 jpt2 jpt3 jpt4 jpt5 jpt6 jpt7 jpt8 jpt9 jpt10 jpt11 jpt12 jpt1 "")
  (command "extrude" "L" "" height)
  (arxunload "geom3d.arx")
  (setvar "osmode" oldsnap)
  (setvar "blipmode" oldblip)
  (setvar "cmdecho" 1)
  (princ)
  )


deegeecees

  • Guest
Re: How would you array this horizotally
« Reply #7 on: May 09, 2008, 02:08:34 PM »
You're not setting some variables that you are referencing, for starters.

daron

  • Guest
Re: How would you array this horizotally
« Reply #8 on: May 09, 2008, 03:16:15 PM »
For starters, this:
Code: [Select]
(setq oldsnap (getvar "osmode"))
  (setvar "osmode" 0)
  (setq oldsnap (getvar "blipmode"))[color=red];Sorry Brad, this was Adesu's mistake, not yours. I just now saw that.[/color]
  (setvar "blipmode" 0)
...
  (setvar "osmode" 0)
...
  (setvar "osmode" oldsnap)
  (setvar "blipmode" oldblip)
  (setvar "cmdecho" 1)
the variable oldnanap gets set as the value for osmode, then you proceed to set osmode to 0 and replace blipmode's value to the variable oldsnap. Now the value for oldsnap is either 1 or 0. Further down the line, without having changed osmode from 0, you change it to 0 again. Then at the bottom, you are changing osmode again to a value derived from blipmode, which is 0 or 1, so depending on what was set, you'll either end up with no running snaps or endpoint. Finally, oldblip was never created and I think what DGC is referring to and then you hard set cmdecho to 1. I see it as just an oversight, but it appears you meant to set blipmode to oldblip. Also, you'll want to get the value for cmdecho in a variable in the beginning and then turn it off if that is what you so desire, then return to the original value when you're done, not hard code it.
« Last Edit: May 09, 2008, 04:08:30 PM by Daron »

deegeecees

  • Guest
Re: How would you array this horizotally
« Reply #9 on: May 09, 2008, 03:24:54 PM »
(setq jpt3 (polar jpt2 (* pi 0.5) height))

This variable needs to be set, or take the "j" off in this line:

(setq jheight 7.625)

deegeecees

  • Guest
Re: How would you array this horizotally
« Reply #10 on: May 09, 2008, 03:26:49 PM »
O.T....   7.625 is the diameter of an M16 round if I remember correctly.   :wink:

daron

  • Guest
Re: How would you array this horizotally
« Reply #11 on: May 09, 2008, 03:27:39 PM »
Seriously, you can tidy it all up by
Code: [Select]
(setq sysvaris
     (mapcar
          '(lambda (x)
               (cons x (getvar x))
           )
           (list "osmode" "blipmode" "cmdecho")
     )
)
You'll end up with a list that looks like:
Code: [Select]
(("osmode" . 6239) ("blipmode" . 0) ("cmdecho" . 1))You can then change any value any way you want except sysvaris and when you're done call:
Code: [Select]
(mapcar '(lambda (x) (setvar (car x) (cdr x))) sysvaris)This is essentially some code I gave you before, but set to be able to be contained directly inside you routine. If you want to add more variables, just add them to the list in the sysvaris variable. If you do this, you will not have the problem described above and your code will look a lot cleaner IMO and be easier to maintain. If you don't understand how or why it's working, just ask. Once you understand how mapcar and cons work, many more ideas will crop up. If you don't like it, let me know. I'd also like a reason as to why, though.
« Last Edit: May 09, 2008, 03:42:53 PM by Daron »

Fatty

  • Guest
Re: How would you array this horizotally
« Reply #12 on: May 09, 2008, 03:59:01 PM »
Hi, mate
First of all change jjpt1 on jpt1 and height on jheight
Then you need to draw the polyline to be extruded
correctly, because of in you code this was drawn as
a self-intersected and you should't to extrude this
contour
Attach the sample picture of this polyline you want
to create
[And also I'm still avoid to use polar function for
parametric drafting (IMO only)]

~'J'~

One Shot

  • Guest
Re: How would you array this horizotally
« Reply #13 on: May 09, 2008, 04:07:45 PM »
O.T....   7.625 is the diameter of an M16 round if I remember correctly.   :wink:

The M16A1 uses a 5.56 mm NATO round .
The M60, M14, AK47, 7.625mm Nato round.

One Shot

  • Guest
Re: How would you array this horizotally
« Reply #14 on: May 09, 2008, 04:10:02 PM »
Hi, mate
First of all change jjpt1 on jpt1 and height on jheight
Then you need to draw the polyline to be extruded
correctly, because of in you code this was drawn as
a self-intersected and you should't to extrude this
contour
Attach the sample picture of this polyline you want
to create
[And also I'm still avoid to use polar function for
parametric drafting (IMO only)]



~'J'~

I think you forgot to attach the picture.

Thank you,

Brad