Author Topic: Drawing polyline from the block  (Read 4374 times)

0 Members and 1 Guest are viewing this topic.

antistar

  • Guest
Drawing polyline from the block
« on: April 23, 2012, 08:05:51 AM »
Hi to all,
I ask a great help to teachers.
I have a block with 4 tags for length, thickness, elevation and width.
Could anyone help me write a routine to capture the data from these tags and draw the closed polyline + 2 internal lines, parallel to the block?
It would be possible to change the dimensions of the drawing whenever I change a tag?

Block Name: ID_DATA
Tags: LEN, THI, ELE and WID.

Thanks in advance.
« Last Edit: April 26, 2012, 12:43:47 PM by antistar »

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Drawing polyline from the block
« Reply #1 on: April 23, 2012, 08:18:30 AM »
The creation of the Polyline based on the block attribute information could certainly be achieved, (this function will help you in that respect); however, the automatic updating of the Polyline dimensions based on the attribute information would be rather complicated, likely requiring the use of reactors.

antistar

  • Guest
Re: Drawing polyline from the block
« Reply #2 on: April 23, 2012, 08:31:08 AM »
The creation of the Polyline based on the block attribute information could certainly be achieved, (this function will help you in that respect); however, the automatic updating of the Polyline dimensions based on the attribute information would be rather complicated, likely requiring the use of reactors.

Ok Lee,
 Thank you for your attention and explanation.
 I understand the complexity of using reactors. The reactors will leave to another step.
 Could you help me create a polyline with the attribute information?
« Last Edit: April 23, 2012, 08:38:34 AM by antistar »

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Drawing polyline from the block
« Reply #3 on: April 23, 2012, 08:35:01 AM »
Could you help me create a polyline with the attribute information?

Post the code that you have started and I'll offer hints and tips  :-)

antistar

  • Guest
Re: Drawing polyline from the block
« Reply #4 on: April 23, 2012, 08:38:13 AM »
Could you help me create a polyline with the attribute information?

Post the code that you have started and I'll offer hints and tips  :-)

Applying his subroutine LM: GetAttributes, I got the following list:

 ((LEN. 140) (THI. 120) (ELE. 100) (WID. 14))
« Last Edit: April 23, 2012, 08:41:28 AM by antistar »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Drawing polyline from the block
« Reply #5 on: April 23, 2012, 08:41:23 AM »
Looks like a window opening.
Why not create a dynamic block and the reactors are built in.
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.

antistar

  • Guest
Re: Drawing polyline from the block
« Reply #6 on: April 23, 2012, 08:44:10 AM »
Looks like a window opening.
Why not create a dynamic block and the reactors are built in.

CAB,
 It is just a window opening. I'm accepting any suggestions.
 Thanks.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Drawing polyline from the block
« Reply #7 on: April 23, 2012, 09:41:12 AM »
Wish I had time, but not today.
Maybe one of the user who know there way around dynamic blocks would help.


I'll move the thread to CAD forum to see if anyone will jump in.
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.

antistar

  • Guest
Re: Drawing polyline from the block
« Reply #8 on: April 23, 2012, 09:48:57 AM »
Wish I had time, but not today.
Maybe one of the user who know there way around dynamic blocks would help.


I'll move the thread to CAD forum to see if anyone will jump in.

CAB,
 Thank you for your attention.
 Something as suggested, will help me a lot.

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Drawing polyline from the block
« Reply #9 on: April 23, 2012, 12:28:59 PM »
I have the routine to make window opening but not as block, but as 3d solids geometry... I used to use this code frequently when I have to model house with windows openings... Only thing is that you have to follow steps exactly explained while executing routine and just to mention your walls if are 3d solids - they have to have openings already subtracted from wall solids... These windows are always "rectangular" viewed in elevation view of facade...

Code: [Select]
(defun c:3d-w ( / -A -AA -AAA -B -BP -DDHP -DDV -DH -DV -H -Z A A1 A2 A3 A4 AA AA1 AA2 AA3 AA4 AAA B B1 B2 B3 B4 BP D DDH DDHP DDV DDVP DH DV H H1 HPR NH NV O OH OSCMD OV PAUSE PT1 PT1AA PT1U PT1UU PT1UUU PT2 PT2AA PT2U PT2UU PT2UUU PT3 PT3AA PT3U PT3UU PT3UUU PT4 PT4AA PT4U PT4UU PT4UUU PT5 PTSU PTSUU PTUUEH PTUUENDH PTUUENDV PTUUEV PTX PTY SPL1 SPL2 SPLA1 SPLA2 SPLU1 SPLU2 SSPL1 SSPL2 SSPLA1 SSPLA2 SSPLU1 SSPLU2 STAK V V1 VPR Z )
(setq oscmd (getvar "osmode"))
(setvar "osmode" 35)
(arxload "geomcal.arx")
(prompt "\nMODELING 3D WINDOW OR DOOR OR FILLING OPENING WITH BARS - ENTER TO CONTINUE")
(print)
(textscr)
(command pause)
(command "ucs" "w")
(setq pt1 (getpoint "\nPick first point of outer edge of wall opening - lower left : "))
(setq pt2 (getpoint "\nPick second point of outer edge of wall opening - lower right : "))
(setq pt3 (getpoint "\nPick third point of outer edge of wall opening - upper right : "))
(setq pt4 (getpoint "\nPick fourth point of outer edge of wall opening - upper left : "))
(setq d (getdist pt1 "\nUnesite debljinu prozora : "))
(setq a 0.0)
(while (eq a 0.0) (setq a (getdist "\nInput thickness of outer frame of window - <must be more than 0 - 2 points> : ")))
(setq b (getdist "\nInput thickness of inner frame of window - <0=no inner frame and no glass solid box - 2 points> : "))
(setq z (getdist "\nInput gap from outer edge of opening to inner frame of window - <0=plane of outer edge - 2 points> : "))
(setq nv (getreal "\nNumber of vertical bars - <ENTER - 0> : "))
(setq nh (getreal "\nNumber of horizontal bars - <ENTER - 0> : "))
(setq aa (getdist "\nInput width of outer frame around opening - <ENTER - 0> : "))
(if (eq aa nil) (setq aa 0))
(if (eq aa 0) (setq aaa 0)
(setq aaa (getdist "\nInput thickness of outer frame around opening - frontal extrusion in front of opening - < 2 points > : "))
)
(if (/= nv nil) (setq ddv (getreal "\nDimensions of vertical bars - d/d , d= : ")) (setq ddv 0.0))
(if (/= nh nil) (setq ddh (getreal "\nDimensions of horizontal bars - d/d , d= : ")) (setq ddh 0.0))
(setvar "osmode" 0)
(command "ucs" "3p" pt1 pt2 pt3)
(setq o '(0 0 0))
(setvar "osmode" 35)
(setq pt5 (getpoint o "\nInput normal vector of UCS - inside point of opening in wall : "))
(command "ucs" "za" o pt5)
(setvar "osmode" 0)
(setq pt1u (trans pt1 0 1))
(setq pt2u (trans pt2 0 1))
(setq pt3u (trans pt3 0 1))
(setq pt4u (trans pt4 0 1))
(command "pline" pt1u pt2u pt3u pt4u "c")
(setq spl1 (ssadd))
(ssadd (entlast) spl1)
(setq ptsu (cal "(pt1u+pt2u+pt3u+pt4u)/4"))
(command "offset" a spl1 ptsu "")
(setq spl2 (ssadd))
(ssadd (entlast) spl2)
(command "extrude" spl1 "" d "")
(setq sspl1 (ssadd))
(ssadd (entlast) sspl1)
(command "extrude" spl2 "" d "")
(setq sspl2 (ssadd))
(ssadd (entlast) sspl2)
(command "subtract" sspl1 "" sspl2 "" "")
(setq -a (- 0 a))
(setq -z (- 0 z))
(setq a1 (list -a a z))
(setq pt1uu (cal "pt1u+a1"))
(setq a2 (list a a z))
(setq pt2uu (cal "pt2u+a2"))
(setq a3 (list a -a z))
(setq pt3uu (cal "pt3u+a3"))
(setq a4 (list -a -a z))
(setq pt4uu (cal "pt4u+a4"))

(if (eq b 0) ()
(progn
(command "pline" pt1uu pt2uu pt3uu pt4uu "c")
(setq splu1 (ssadd))
(ssadd (entlast) splu1)
(setq ptsuu (cal "(pt1uu+pt2uu+pt3uu+pt4uu)/4"))
(command "offset" b splu1 ptsuu "")
(setq splu2 (ssadd))
(ssadd (entlast) splu2)
(command "extrude" splu1 "" b "")
(setq ssplu1 (ssadd))
(ssadd (entlast) ssplu1)
(command "extrude" splu2 "" b "")
(setq ssplu2 (ssadd))
(ssadd (entlast) ssplu2)
(command "subtract" ssplu1 "" ssplu2 "" "")
(setq -b (- 0 b))
(setq bp (/ b 2))
(setq -bp (- 0 bp))
(setq b1 (list -b b bp))
(setq pt1uuu (cal "pt1uu+b1"))
(setq b2 (list b b bp))
(setq pt2uuu (cal "pt2uu+b2"))
(setq b3 (list b -b bp))
(setq pt3uuu (cal "pt3uu+b3"))
(setq b4 (list -b -b bp))
(setq pt4uuu (cal "pt4uu+b4"))
(command "pline" pt1uuu pt2uuu pt3uuu pt4uuu "c")
(setq stak (ssadd))
(ssadd (entlast) stak)
(command "extrude" stak "" bp "")
))

(if (/= nv nil)
(progn
(setq v (distance pt1uu pt4uu))
(setq dv (/ v (+ nh 1)))
(setq -dv (- 0 dv))
(setq ov (list 0 dv 0))
(setq -ddv (- 0 ddv))
(setq ddvp (/ ddv 2))
(setq ptuuev (list -ddv v 0))
(setq ptuuendv (cal "pt1uu+ptuuev"))
(command "rectangle" pt1uu ptuuendv "")
(setq vpr (ssadd))
(ssadd (entlast) vpr)
(command "extrude" vpr "" ddv "")
(setq v1 (ssadd))
(ssadd (entlast) v1)
(setq ptx (list ddvp 0 0))
(command "move" v1 "" o ptx)
(repeat (fix nv)
(command "copy" (entlast) "" o oh)
)
(command "erase" v1 "")
))

(if (/= nh nil)
(progn
(setq h (distance pt1uu pt2uu))
(setq dh (/ h (+ nv 1)))
(setq -dh (- 0 dh))
(setq oh (list -dh 0 0))
(setq -h (- 0 h))
(setq ddhp (/ ddh 2))
(setq -ddhp (- 0 ddhp))
(setq ptuueh (list -h ddh 0))
(setq ptuuendh (cal "pt1uu+ptuueh"))
(command "rectangle" pt1uu ptuuendh "")
(setq hpr (ssadd))
(ssadd (entlast) hpr)
(command "extrude" hpr "" ddh "")
(setq h1 (ssadd))
(ssadd (entlast) h1)
(setq pty (list 0 -ddhp 0))
(command "move" h1 "" o pty)
(repeat (fix nh)
(command "copy" (entlast) "" o ov)
)
(command "erase" h1 "")
))

(if (and (eq aa 0) (eq aaa 0)) ()
(progn
(setq -aa (- 0 aa))
(setq aa1 (list aa -aa 0))
(setq pt1aa (cal "pt1u+aa1"))
(setq aa2 (list -aa -aa 0))
(setq pt2aa (cal "pt2u+aa2"))
(setq aa3 (list -aa aa 0))
(setq pt3aa (cal "pt3u+aa3"))
(setq aa4 (list aa aa 0))
(setq pt4aa (cal "pt4u+aa4"))
(setq -aaa (- 0 aaa))
(command "pline" pt1aa pt2aa pt3aa pt4aa "c")
(setq spla1 (ssadd))
(ssadd (entlast) spla1)
(command "offset" aa spla1 ptsu "")
(setq spla2 (ssadd))
(ssadd (entlast) spla2)
(command "extrude" spla1 "" -aaa "")
(setq sspla1 (ssadd))
(ssadd (entlast) sspla1)
(command "extrude" spla2 "" -aaa "")
(setq sspla2 (ssadd))
(ssadd (entlast) sspla2)
(command "subtract" sspla1 "" sspla2 "" "")
))

(command "ucs" "w")
(setvar "osmode" oscmd)

(princ)
)

Hope this helps... To me it helped lots of times...
Marko Ribar, d.i.a. (architect)
 :-)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

antistar

  • Guest
Re: Drawing polyline from the block
« Reply #10 on: April 23, 2012, 01:48:01 PM »
I have the routine to make window opening but not as block, but as 3d solids geometry... I used to use this code frequently when I have to model house with windows openings... Only thing is that you have to follow steps exactly explained while executing routine and just to mention your walls if are 3d solids - they have to have openings already subtracted from wall solids... These windows are always "rectangular" viewed in elevation view of facade...

Code: [Select]
(defun c:3d-w ( / -A -AA -AAA -B -BP -DDHP -DDV -DH -DV -H -Z A A1 A2 A3 A4 AA AA1 AA2 AA3 AA4 AAA B B1 B2 B3 B4 BP D DDH DDHP DDV DDVP DH DV H H1 HPR NH NV O OH OSCMD OV PAUSE PT1 PT1AA PT1U PT1UU PT1UUU PT2 PT2AA PT2U PT2UU PT2UUU PT3 PT3AA PT3U PT3UU PT3UUU PT4 PT4AA PT4U PT4UU PT4UUU PT5 PTSU PTSUU PTUUEH PTUUENDH PTUUENDV PTUUEV PTX PTY SPL1 SPL2 SPLA1 SPLA2 SPLU1 SPLU2 SSPL1 SSPL2 SSPLA1 SSPLA2 SSPLU1 SSPLU2 STAK V V1 VPR Z )
(setq oscmd (getvar "osmode"))
(setvar "osmode" 35)
(arxload "geomcal.arx")
(prompt "\nMODELING 3D WINDOW OR DOOR OR FILLING OPENING WITH BARS - ENTER TO CONTINUE")
(print)
(textscr)
(command pause)
(command "ucs" "w")
(setq pt1 (getpoint "\nPick first point of outer edge of wall opening - lower left : "))
(setq pt2 (getpoint "\nPick second point of outer edge of wall opening - lower right : "))
(setq pt3 (getpoint "\nPick third point of outer edge of wall opening - upper right : "))
(setq pt4 (getpoint "\nPick fourth point of outer edge of wall opening - upper left : "))
(setq d (getdist pt1 "\nUnesite debljinu prozora : "))
(setq a 0.0)
(while (eq a 0.0) (setq a (getdist "\nInput thickness of outer frame of window - <must be more than 0 - 2 points> : ")))
(setq b (getdist "\nInput thickness of inner frame of window - <0=no inner frame and no glass solid box - 2 points> : "))
(setq z (getdist "\nInput gap from outer edge of opening to inner frame of window - <0=plane of outer edge - 2 points> : "))
(setq nv (getreal "\nNumber of vertical bars - <ENTER - 0> : "))
(setq nh (getreal "\nNumber of horizontal bars - <ENTER - 0> : "))
(setq aa (getdist "\nInput width of outer frame around opening - <ENTER - 0> : "))
(if (eq aa nil) (setq aa 0))
(if (eq aa 0) (setq aaa 0)
(setq aaa (getdist "\nInput thickness of outer frame around opening - frontal extrusion in front of opening - < 2 points > : "))
)
(if (/= nv nil) (setq ddv (getreal "\nDimensions of vertical bars - d/d , d= : ")) (setq ddv 0.0))
(if (/= nh nil) (setq ddh (getreal "\nDimensions of horizontal bars - d/d , d= : ")) (setq ddh 0.0))
(setvar "osmode" 0)
(command "ucs" "3p" pt1 pt2 pt3)
(setq o '(0 0 0))
(setvar "osmode" 35)
(setq pt5 (getpoint o "\nInput normal vector of UCS - inside point of opening in wall : "))
(command "ucs" "za" o pt5)
(setvar "osmode" 0)
(setq pt1u (trans pt1 0 1))
(setq pt2u (trans pt2 0 1))
(setq pt3u (trans pt3 0 1))
(setq pt4u (trans pt4 0 1))
(command "pline" pt1u pt2u pt3u pt4u "c")
(setq spl1 (ssadd))
(ssadd (entlast) spl1)
(setq ptsu (cal "(pt1u+pt2u+pt3u+pt4u)/4"))
(command "offset" a spl1 ptsu "")
(setq spl2 (ssadd))
(ssadd (entlast) spl2)
(command "extrude" spl1 "" d "")
(setq sspl1 (ssadd))
(ssadd (entlast) sspl1)
(command "extrude" spl2 "" d "")
(setq sspl2 (ssadd))
(ssadd (entlast) sspl2)
(command "subtract" sspl1 "" sspl2 "" "")
(setq -a (- 0 a))
(setq -z (- 0 z))
(setq a1 (list -a a z))
(setq pt1uu (cal "pt1u+a1"))
(setq a2 (list a a z))
(setq pt2uu (cal "pt2u+a2"))
(setq a3 (list a -a z))
(setq pt3uu (cal "pt3u+a3"))
(setq a4 (list -a -a z))
(setq pt4uu (cal "pt4u+a4"))

(if (eq b 0) ()
(progn
(command "pline" pt1uu pt2uu pt3uu pt4uu "c")
(setq splu1 (ssadd))
(ssadd (entlast) splu1)
(setq ptsuu (cal "(pt1uu+pt2uu+pt3uu+pt4uu)/4"))
(command "offset" b splu1 ptsuu "")
(setq splu2 (ssadd))
(ssadd (entlast) splu2)
(command "extrude" splu1 "" b "")
(setq ssplu1 (ssadd))
(ssadd (entlast) ssplu1)
(command "extrude" splu2 "" b "")
(setq ssplu2 (ssadd))
(ssadd (entlast) ssplu2)
(command "subtract" ssplu1 "" ssplu2 "" "")
(setq -b (- 0 b))
(setq bp (/ b 2))
(setq -bp (- 0 bp))
(setq b1 (list -b b bp))
(setq pt1uuu (cal "pt1uu+b1"))
(setq b2 (list b b bp))
(setq pt2uuu (cal "pt2uu+b2"))
(setq b3 (list b -b bp))
(setq pt3uuu (cal "pt3uu+b3"))
(setq b4 (list -b -b bp))
(setq pt4uuu (cal "pt4uu+b4"))
(command "pline" pt1uuu pt2uuu pt3uuu pt4uuu "c")
(setq stak (ssadd))
(ssadd (entlast) stak)
(command "extrude" stak "" bp "")
))

(if (/= nv nil)
(progn
(setq v (distance pt1uu pt4uu))
(setq dv (/ v (+ nh 1)))
(setq -dv (- 0 dv))
(setq ov (list 0 dv 0))
(setq -ddv (- 0 ddv))
(setq ddvp (/ ddv 2))
(setq ptuuev (list -ddv v 0))
(setq ptuuendv (cal "pt1uu+ptuuev"))
(command "rectangle" pt1uu ptuuendv "")
(setq vpr (ssadd))
(ssadd (entlast) vpr)
(command "extrude" vpr "" ddv "")
(setq v1 (ssadd))
(ssadd (entlast) v1)
(setq ptx (list ddvp 0 0))
(command "move" v1 "" o ptx)
(repeat (fix nv)
(command "copy" (entlast) "" o oh)
)
(command "erase" v1 "")
))

(if (/= nh nil)
(progn
(setq h (distance pt1uu pt2uu))
(setq dh (/ h (+ nv 1)))
(setq -dh (- 0 dh))
(setq oh (list -dh 0 0))
(setq -h (- 0 h))
(setq ddhp (/ ddh 2))
(setq -ddhp (- 0 ddhp))
(setq ptuueh (list -h ddh 0))
(setq ptuuendh (cal "pt1uu+ptuueh"))
(command "rectangle" pt1uu ptuuendh "")
(setq hpr (ssadd))
(ssadd (entlast) hpr)
(command "extrude" hpr "" ddh "")
(setq h1 (ssadd))
(ssadd (entlast) h1)
(setq pty (list 0 -ddhp 0))
(command "move" h1 "" o pty)
(repeat (fix nh)
(command "copy" (entlast) "" o ov)
)
(command "erase" h1 "")
))

(if (and (eq aa 0) (eq aaa 0)) ()
(progn
(setq -aa (- 0 aa))
(setq aa1 (list aa -aa 0))
(setq pt1aa (cal "pt1u+aa1"))
(setq aa2 (list -aa -aa 0))
(setq pt2aa (cal "pt2u+aa2"))
(setq aa3 (list -aa aa 0))
(setq pt3aa (cal "pt3u+aa3"))
(setq aa4 (list aa aa 0))
(setq pt4aa (cal "pt4u+aa4"))
(setq -aaa (- 0 aaa))
(command "pline" pt1aa pt2aa pt3aa pt4aa "c")
(setq spla1 (ssadd))
(ssadd (entlast) spla1)
(command "offset" aa spla1 ptsu "")
(setq spla2 (ssadd))
(ssadd (entlast) spla2)
(command "extrude" spla1 "" -aaa "")
(setq sspla1 (ssadd))
(ssadd (entlast) sspla1)
(command "extrude" spla2 "" -aaa "")
(setq sspla2 (ssadd))
(ssadd (entlast) sspla2)
(command "subtract" sspla1 "" sspla2 "" "")
))

(command "ucs" "w")
(setvar "osmode" oscmd)

(princ)
)

Hope this helps... To me it helped lots of times...
Marko Ribar, d.i.a. (architect)
 :-)


Hi Marko,
 His routine is very interesting, but unfortunately does not make what I need.
 Accurate data frame with the window and the design of the window to capture the information block.

 Even so, thank you for your attention.

ribarm

  • Gator
  • Posts: 3279
  • Marko Ribar, architect
Re: Drawing polyline from the block
« Reply #11 on: November 25, 2012, 05:25:48 AM »
The code wasn't properly debugged, and I've modified it a little...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:3d-w ( / -A -AA -AAA -B -BP -DDHP -DDV -DH -DV -H -Z A A1 A2 A3 A4 AA AA1 AA2 AA3 AA4 AAA B B1 B2 B3 B4 BP D DDH DDHP DDV DDVP DH DV H H1 HPR NH NV O OH OSCMD OV PT1 PT1AA PT1U PT1UU PT1UUU PT2 PT2AA PT2U PT2UU PT2UUU PT3 PT3AA PT3U PT3UU PT3UUU PT4 PT4AA PT4U PT4UU PT4UUU PT5 PTSU PTSUU PTUUEH PTUUENDH PTUUENDV PTUUEV PTX PTY SPL1 SPL2 SPLA1 SPLA2 SPLU1 SPLU2 SSPL1 SSPL2 SSPLA1 SSPLA2 SSPLU1 SSPLU2 STAK V V1 VPR Z )
  2. (setq oscmd (getvar "osmode"))
  3. (setvar "osmode" 35)
  4. (arxload "geomcal.arx")
  5. (prompt "\nMODELING 3D WINDOW OR DOOR OR FILLING OPENING WITH BARS - ENTER TO CONTINUE")
  6. (command pause)
  7. (command "ucs" "w")
  8. (setq pt1 (getpoint "\nPick first point of outer edge of wall opening - lower left : "))
  9. (setq pt2 (getpoint "\nPick second point of outer edge of wall opening - lower right : "))
  10. (setq pt3 (getpoint "\nPick third point of outer edge of wall opening - upper right : "))
  11. (setq pt4 (getpoint "\nPick fourth point of outer edge of wall opening - upper left : "))
  12. (setq d (getdist pt1 "\nInput width of window : "))
  13. (setq a 0.0)
  14. (while (eq a 0.0) (setq a (getdist "\nInput thickness of outer frame of window - <must be more than 0 - 2 points> : ")))
  15. (setq b (getdist "\nInput thickness of inner frame of window - <0=no inner frame and no glass solid box - 2 points> : "))
  16. (setq z (getdist "\nInput gap from outer edge of opening to inner frame of window - <0=plane of outer edge - 2 points> : "))
  17. (setq nv (getreal "\nNumber of vertical bars - <ENTER - 0> : "))
  18. (setq nh (getreal "\nNumber of horizontal bars - <ENTER - 0> : "))
  19. (setq aa (getdist "\nInput width of outer frame around opening - <ENTER - 0> : "))
  20. (if (eq aa nil) (setq aa 0))
  21. (if (eq aa 0) (setq aaa 0)
  22. (setq aaa (getdist "\nInput thickness of outer frame around opening - frontal extrusion in front of opening - < 2 points > : "))
  23. )
  24. (if (and (/= nv 0) (/= nv nil)) (setq ddv (getreal "\nDimensions of vertical bars - d/d , d= : ")) (setq ddv 0.0 nv 0))
  25. (if (and (/= nh 0) (/= nh nil)) (setq ddh (getreal "\nDimensions of horizontal bars - d/d , d= : ")) (setq ddh 0.0 nh 0))
  26. (setvar "osmode" 0)
  27. (command "ucs" "3p" pt1 pt2 pt3)
  28. (setq o '(0 0 0))
  29. (setvar "osmode" 35)
  30. (setq pt5 (getpoint o "\nInput normal vector of UCS - inside point of opening in wall : "))
  31. (command "ucs" "za" o pt5)
  32. (setvar "osmode" 0)
  33. (setq pt1u (trans pt1 0 1))
  34. (setq pt2u (trans pt2 0 1))
  35. (setq pt3u (trans pt3 0 1))
  36. (setq pt4u (trans pt4 0 1))
  37. (command "pline" pt1u pt2u pt3u pt4u "c")
  38. (setq spl1 (ssadd))
  39. (ssadd (entlast) spl1)
  40. (setq ptsu (cal "(pt1u+pt2u+pt3u+pt4u)/4"))
  41. (command "offset" a spl1 ptsu "")
  42. (setq spl2 (ssadd))
  43. (ssadd (entlast) spl2)
  44. (command "extrude" spl1 "" d "")
  45. (setq sspl1 (ssadd))
  46. (ssadd (entlast) sspl1)
  47. (command "extrude" spl2 "" d "")
  48. (setq sspl2 (ssadd))
  49. (ssadd (entlast) sspl2)
  50. (command "subtract" sspl1 "" sspl2 "" "")
  51. (setq -a (- 0 a))
  52. (setq -z (- 0 z))
  53. (setq a1 (list -a a z))
  54. (setq pt1uu (cal "pt1u+a1"))
  55. (setq a2 (list a a z))
  56. (setq pt2uu (cal "pt2u+a2"))
  57. (setq a3 (list a -a z))
  58. (setq pt3uu (cal "pt3u+a3"))
  59. (setq a4 (list -a -a z))
  60. (setq pt4uu (cal "pt4u+a4"))
  61.  
  62. (if (not (eq b 0))
  63. (command "pline" pt1uu pt2uu pt3uu pt4uu "c")
  64. (setq splu1 (ssadd))
  65. (ssadd (entlast) splu1)
  66. (setq ptsuu (cal "(pt1uu+pt2uu+pt3uu+pt4uu)/4"))
  67. (command "offset" b splu1 ptsuu "")
  68. (setq splu2 (ssadd))
  69. (ssadd (entlast) splu2)
  70. (command "extrude" splu1 "" b "")
  71. (setq ssplu1 (ssadd))
  72. (ssadd (entlast) ssplu1)
  73. (command "extrude" splu2 "" b "")
  74. (setq ssplu2 (ssadd))
  75. (ssadd (entlast) ssplu2)
  76. (command "subtract" ssplu1 "" ssplu2 "" "")
  77.  
  78. (setq -b (- 0 b))
  79. (setq bp (/ b 2))
  80. (setq -bp (- 0 bp))
  81. (setq b1 (list -b b bp))
  82. (setq pt1uuu (cal "pt1uu+b1"))
  83. (setq b2 (list b b bp))
  84. (setq pt2uuu (cal "pt2uu+b2"))
  85. (setq b3 (list b -b bp))
  86. (setq pt3uuu (cal "pt3uu+b3"))
  87. (setq b4 (list -b -b bp))
  88. (setq pt4uuu (cal "pt4uu+b4"))
  89.  
  90. (command "pline" pt1uuu pt2uuu pt3uuu pt4uuu "c")
  91. (setq stak (ssadd))
  92. (ssadd (entlast) stak)
  93. (command "extrude" stak "" bp "")
  94. ))
  95.  
  96. (setq v (distance pt1uu pt4uu))
  97. (setq dv (/ v (+ nh 1)))
  98. (setq -dv (- 0 dv))
  99. (setq ov (list 0 dv 0))
  100. (setq -ddv (- 0 ddv))
  101. (setq ddvp (/ ddv 2))
  102. (setq ptuuev (list -ddv v 0))
  103. (setq ptuuendv (cal "pt1uu+ptuuev"))
  104.  
  105. (setq h (distance pt1uu pt2uu))
  106. (setq dh (/ h (+ nv 1)))
  107. (setq -dh (- 0 dh))
  108. (setq oh (list -dh 0 0))
  109. (setq -h (- 0 h))
  110. (setq ddhp (/ ddh 2))
  111. (setq -ddhp (- 0 ddhp))
  112. (setq ptuueh (list -h ddh 0))
  113. (setq ptuuendh (cal "pt1uu+ptuueh"))
  114.  
  115. (if (/= nv 0)
  116. (command "rectangle" pt1uu ptuuendv "")
  117. (setq vpr (ssadd))
  118. (ssadd (entlast) vpr)
  119. (command "extrude" vpr "" ddv "")
  120. (setq v1 (ssadd))
  121. (ssadd (entlast) v1)
  122. (setq ptx (list ddvp 0 0))
  123. (command "move" v1 "" o ptx)
  124. (repeat (fix nv)
  125. (command "copy" (entlast) "" o oh)
  126. )
  127. (command "erase" v1 "")
  128. ))
  129.  
  130. (if (/= nh 0)
  131. (command "rectangle" pt1uu ptuuendh "")
  132. (setq hpr (ssadd))
  133. (ssadd (entlast) hpr)
  134. (command "extrude" hpr "" ddh "")
  135. (setq h1 (ssadd))
  136. (ssadd (entlast) h1)
  137. (setq pty (list 0 -ddhp 0))
  138. (command "move" h1 "" o pty)
  139. (repeat (fix nh)
  140. (command "copy" (entlast) "" o ov)
  141. )
  142. (command "erase" h1 "")
  143. ))
  144.  
  145. (if (not (and (eq aa 0) (eq aaa 0)))
  146.  
  147. (setq -aa (- 0 aa))
  148. (setq aa1 (list aa -aa 0))
  149. (setq pt1aa (cal "pt1u+aa1"))
  150. (setq aa2 (list -aa -aa 0))
  151. (setq pt2aa (cal "pt2u+aa2"))
  152. (setq aa3 (list -aa aa 0))
  153. (setq pt3aa (cal "pt3u+aa3"))
  154. (setq aa4 (list aa aa 0))
  155. (setq pt4aa (cal "pt4u+aa4"))
  156.  
  157. (setq -aaa (- 0 aaa))
  158.  
  159. (command "pline" pt1aa pt2aa pt3aa pt4aa "c")
  160. (setq spla1 (ssadd))
  161. (ssadd (entlast) spla1)
  162. (command "offset" aa spla1 ptsu "")
  163. (setq spla2 (ssadd))
  164. (ssadd (entlast) spla2)
  165. (command "extrude" spla1 "" -aaa "")
  166. (setq sspla1 (ssadd))
  167. (ssadd (entlast) sspla1)
  168. (command "extrude" spla2 "" -aaa "")
  169. (setq sspla2 (ssadd))
  170. (ssadd (entlast) sspla2)
  171. (command "subtract" sspla1 "" sspla2 "" "")
  172. ))
  173.  
  174. (command "ucs" "w")
  175. (setvar "osmode" oscmd)
  176.  
  177. )
  178.  

M.R. (Hope this has now sense since I am using it constantly...) :-)
« Last Edit: December 08, 2012, 10:04:50 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube