Author Topic: Footings  (Read 1946 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Footings
« on: May 24, 2007, 04:19:08 PM »
The intent of the following lisp is to draw the footing lines on opposite sides of the foundation wall, but in some instances it draws both lines on the same side of the wall.
I have encounter this problem before in other lisps I have written but at this moment in time I am having a brain fart and can't quite figure it out. :ugly:

Code: [Select]
(Defun C:FT ( );
  (setvar "cmdecho" 0)   
  (setq OSM (setvar "Osmode" 0)
  )
  (setvar "osmode" 1)
  (setq PNT (getpoint "\nStarting point: ")
  );
  (setvar "Osmode" 128)
  (setq EPT (getpoint PNT "\nPick point opposite wall:");
        WDT (distance PNT EPT)
PT2 1
  );
  (while (/= PT2 Nil)
     (setvar "osmode" 1)
     (setq PT2 (getpoint PNT "\nNext Point: "))     
     (setvar "osmode" 0)
     (if (/= PT2 Nil)
         (progn
     (setq AGT (angle PNT EPT)
           AGB (+ ANG (angtof "180"))    
   DST (+ WDT 6)    
   PTA (polar PNT AGB 6)
   PTA (polar PTA ANG 6)    
   PTX (polar PNT ANG (+ 6 DST))
   
     );
     (if (= OBJ Nil)
         (command "_.Pline" PNT PT2 "")
         (progn
          (command "_.line" PNT PT2 "")
(setq SEG (entlast))
(command "_.Pedit" OBJ "J" SEG "" ""
      "_.Erase" LN1 LN2 ""
  )       );
     );if
    (setq OBJ (entlast));
    (command "_.Offset" 6 OBJ PTA "")
    (setq LN1 (entlast));
    (command "_.Offset" DST OBJ PTX "")
    (setq LN2 (entlast));
    (setq PNT PT2)   
     )  );if
  );while
  (command "_.Erase" OBJ "")
);done

Any help would be greatly appreciated.  :mrgreen:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Footings
« Reply #1 on: May 24, 2007, 11:07:28 PM »
I'll look at it tomorrow, too sleepy tonight. :-(

Have you tried this one?
http://www.theswamp.org/index.php?topic=1986.msg25569#msg25569
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.

Adesu

  • Guest
Re: Footings
« Reply #2 on: May 25, 2007, 12:00:36 AM »
Hi Shade,
I'm really not yet understnad what are doing with your code,but you should test this code.
Code: [Select]
(defun c:ft (/ agb agt dst ept ln1 ln2 obj osm pnt pt2 pta ptx seg wdt)
  (setvar "cmdecho" 0)
  (setq osm (setvar "osmode" 0))
  (setvar "osmode" 1)
  (setq pnt (getpoint "\nstarting point: "))
  (setvar "osmode" 128)
  (setq ept (getpoint pnt "\npick point opposite wall:"))
  (setq wdt (distance pnt ept))
  (setq pt2 1)
  (while
    (/= pt2 nil)
    (setvar "osmode" 1)
    (setq pt2 (getpoint pnt "\nnext point: "))
    (setvar "osmode" 0)
    (if
      (/= pt2 nil)
      (progn
(setq agt (angle pnt ept))
(setq agb (+ agt (angtof "180")))
(setq dst (+ wdt 6))
(setq pta (polar pnt agb 6))
(setq pta (polar pta agb 6))
(setq ptx (polar pnt agb (+ 6 dst)))
(if
  (= obj nil)
  (command "_.pline" pnt pt2 "")
  (progn
    (command "_.line" pnt pt2 "")
    (setq seg (entlast))
    (command "_.pedit" obj "j" seg "" "")
    (command "_.erase" ln1 ln2 "")
    )
  );if
(setq obj (entlast))
(command "_.offset" 6 obj pta "")
(setq ln1 (entlast))
(command "_.offset" dst obj ptx "")
(setq ln2 (entlast))
(setq pnt pt2)
)
      );if
    );while
  (command "_.erase" obj "")
  );done

The intent of the following lisp is to draw the footing lines on opposite sides of the foundation wall, but in some instances it draws both lines on the same side of the wall.
I have encounter this problem before in other lisps I have written but at this moment in time I am having a brain fart and can't quite figure it out. :ugly:

Code: [Select]
(Defun C:FT ( );
  (setvar "cmdecho" 0)   
  (setq OSM (setvar "Osmode" 0)
  )
  (setvar "osmode" 1)
  (setq PNT (getpoint "\nStarting point: ")
  );
  (setvar "Osmode" 128)
  (setq EPT (getpoint PNT "\nPick point opposite wall:");
        WDT (distance PNT EPT)
PT2 1
  );
  (while (/= PT2 Nil)
     (setvar "osmode" 1)
     (setq PT2 (getpoint PNT "\nNext Point: "))     
     (setvar "osmode" 0)
     (if (/= PT2 Nil)
         (progn
     (setq AGT (angle PNT EPT)
           AGB (+ ANG (angtof "180"))    
   DST (+ WDT 6)    
   PTA (polar PNT AGB 6)
   PTA (polar PTA ANG 6)    
   PTX (polar PNT ANG (+ 6 DST))
   
     );
     (if (= OBJ Nil)
         (command "_.Pline" PNT PT2 "")
         (progn
          (command "_.line" PNT PT2 "")
(setq SEG (entlast))
(command "_.Pedit" OBJ "J" SEG "" ""
      "_.Erase" LN1 LN2 ""
  )       );
     );if
    (setq OBJ (entlast));
    (command "_.Offset" 6 OBJ PTA "")
    (setq LN1 (entlast));
    (command "_.Offset" DST OBJ PTX "")
    (setq LN2 (entlast));
    (setq PNT PT2)   
     )  );if
  );while
  (command "_.Erase" OBJ "")
);done

Any help would be greatly appreciated.  :mrgreen: