+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Junior Member POOCRACKIN's Avatar
    Computer Details
    POOCRACKIN's Computer Details
    Operating System:
    VISTA
    Using
    AutoCAD 2010
    Join Date
    Nov 2009
    Location
    UNITED STATE OF GEORGIA
    Posts
    11

    Default Polar Problems In Lisp

    Registered forum members do not see this ad.

    HA, FIRST POST., .,
    I HAVE ONLY BEEN LISPING FOR A MONTH AND A HALF IN MY FREE TIME, BIG WORLD TO DIVE INTO., ,. IN THE LISP I AM WORKING ON, I WANTED TO CREATE A 2-D REPRESENTATION OF A HOLE IN SIDEVIEW DWGS OF STEEL CONN. PLATES. (EX. OF CONN. PLATE: "LINE" "@24<180 @1<270 @24<0 @1<90 @24<180" )
    PROBLEM IS, AFTER MUCH THOUGHT AND WORK I CAN GET "HOLES" CONSISTENTLY AT ORTHO ANGLES, BUT NOT AT ALL OTHER ANGLES. I AM AT A LOSS AS TO WHY., ,
    HERES THE CODE, OF COURSE I AM NEW SO., SOLVING THE PROBLEM WOULD BE GREAT, OTHERWISE., ANY "YOU SHOULD HAVE DONE IT THIS WAY" WILL CERTAINLY BE APPRECIATED.. I'M STILL TRYING TO GRASP THE WHOLE "HOW TO" OF IT ALL.
    I HOPE I GOT THE CODE TAGS RIGHT

    Code:
    (DEFUN *ERROR* (MSG)      
    (SETVAR "OSMODE" OSM)     
    (SETVAR "ORTHOMODE" OMD)  
    (SETVAR "POLARMODE" PMD)  
    (SETVAR "CMDECHO" 1)      
    (PRINC MSG)               
    (PRINC                  
     )                                                                 
      )                                                                 
    (defun C:HO (/ OMD PMD OSM WTH DFC DTC LSP VOBJ ENDP LINC XSP YSP 
    	     XEP YEP XDIF RXDIF YDIF RYDIF XPT YPT MIDPT CAN CP1   
    	     OFP1 OFP2 XCP YCP POO HPX1 HPX2 HPY1 HPY2 HCH1 HCH2   
    	     CCPC HOLE HO2MC HDS1 HDS2 THDS1 THDS2)              
                                                                      
           (VL-LOAD-COM)                                               
           (SETVAR "CMDECHO" 0                                        
    	 )                                                         
    (WHILE (NULL (SETQ                                                 
          LIN (CAR (ENTSEL "\nPICK LINE LENGTH TO REFERENCE >:)"))))   
           )                                                           
    (SETQ OMD (GETVAR "ORTHOMODE")                                     
          PMD (GETVAR "POLARMODE")                                     
          OSM (GETVAR "OSMODE")                                        
          WTH (GETDIST "\nTYPE WIDTH OF HOLE)")                        
          DFC (/ WTH 2)                                                
          DTC (GETDIST "\nTYPE DISTANCE TO CENTER OF HOLE:(")          
          LSP (CDR (ASSOC 10 (ENTGET LIN)))                               
          vObj(vlax-ename->vla-object LIN)                             
          ENDP(vlax-safearray->list (vlax-variant-value (vla-get-endpoint VOBJ)))  
          LINC(CDR(ASSOC 10 (ENTGET LIN)))
          XSP (CAR LINC)
          YSP (CADR LINC)
          XEP (CAR ENDP)
          YEP (CADR ENDP)
           )   
    (IF (> XEP XSP)(SETQ XDIF (- XEP XSP))(SETQ XDIF (- XSP XEP)))
    (SETQ RXDIF (/ (ABS XDIF) 2))
    (IF (> YEP YSP)(SETQ YDIF (- YEP YSP))(SETQ YDIF (- YSP YEP)))
    (SETQ RYDIF (/ (ABS YDIF) 2)
          )
    (COND ((<= XSP XEP)(SETQ XPT (+ XSP RXDIF)))
           ((< XEP XSP)(SETQ XPT (+ XEP RXDIF)))
      )     
    (COND ((<= YSP YEP)(SETQ YPT (+ YSP RYDIF)))
           ((< YEP YSP)(SETQ YPT (+ YEP RYDIF)))
      )
    (SETQ MIDPT(LIST XPT YPT)
      )
              (SETVAR "OSMODE" 0)  
              (SETVAR "POLARMODE" 2
    	      )
    (SETQ CAN (GETORIENT "\nDIRECTION FROM SELECTED LINE" LSP)
          CP1 (POLAR MIDPT CAN DTC)
          OFP2(POLAR MIDPT CAN (+ DTC DFC))
          OFP1(POLAR MIDPT CAN (- DTC DFC))      
          XCP (CAR CP1)
          YCP (CADR CP1)
          POO 0.09876
          HPX1 (+ XCP POO)
          HPX2 (- XCP POO)
          HPY1 (+ YCP POO)
          HPY2 (- YCP POO)
          HCH1 (LIST HPX1 HPY1)
          HCH2 (LIST HPX2 HPY2) 
           )  
    (COMMAND "ROTATE" EVER "" LINC "REFERENCE" LINC ENDP ANGSP)             
    (COMMAND "MOVE" LIN "" MIDPT CP1)
    (COMMAND "COPY" LIN "" CP1 MIDPT)
    (COMMAND "OFFSET" DFC LIN OFP1 "E")
    (COMMAND "OFFSET" DFC LIN OFP2 "E")  
    (COMMAND "SCALE" LIN "" CP1 "1.5")
    (COMMAND "-HATCH" "P" "SOLID" HCH1 HCH2 ""
       )
    (SETQ CCPC (LIST (LIST (CAR OFP1)(CADR OFP1))(LIST (CAR OFP2)(CADR OFP2))(LIST XCP YCP)) 
          HOLE (SSGET "_CP" CCPC)      
          HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          HO2MC(POLAR CP1 CAN HDS1)
    	)	    
    (COMMAND "COPY" HOLE "" CP1 HO2MC)
    
    ;;---CONDENSE--CONDENSE--CONDENSE--CONDENSE
      
    (SETQ HDS2 (GETDIST "n\DIST TO NEXT HOLE")
          THDS1(+ HDS1 HDS2)
          HO2MC (POLAR CP1 CAN THDS1)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS2(+ HDS1 THDS1)
          HO2MC(POLAR CP1 CAN THDS2)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS1(+ HDS1 THDS2)
          HO2MC(POLAR CP1 CAN THDS1)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS2(+ HDS1 THDS1)
          HO2MC(POLAR CP1 CAN THDS2)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS1(+ HDS1 THDS2)
          HO2MC(POLAR CP1 CAN THDS1)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS2(+ HDS1 THDS1)
          HO2MC(POLAR CP1 CAN THDS2)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
      (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS1(+ HDS1 THDS2)
          HO2MC(POLAR CP1 CAN THDS1)
             )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
    (SETQ HDS1 (GETDIST "n\DIST TO NEXT HOLE")
          THDS2(+ HDS1 THDS1)
          HO2MC(POLAR CP1 CAN THDS2)
            )      
    (COMMAND "COPY" HOLE "" CP1 HO2MC
       )
              (SETVAR "POLARMODE" PMD)
              (SETVAR "OSMODE" OSM)
    (PRINC)
    )

  2. #2
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jan 2007
    Posts
    159

    Default

    Shh. No need to shout

    I think you are looking for the polar command

    Code:
    ;convert ENDP point to 3d point (list)
    (setq p1 (list (car ENDP)(cadr ENDP) 0.0))
    ;create new point at distance (real number) 
    ;at angle (radians)
    (setq p2(polar p1(* 180 (/ radians  pi)) distance))
    where you are using vlax-safearray->list you could use
    Code:
    (setq ENDP (cdr (assoc 11 LIN))))
    Not sure if that is what you are after. I would recommend using meaningful variable names



    for example: ENDP - endPoint

    Just as useful, proper case function names

    for example GETPOINT - GetPoint (or java convention getPoint)

    EDIT: variable name POO, c'mon wtf

    Hope this helps
    Ollie
    Last edited by ollie; 14th Jan 2010 at 11:23 pm.

  3. #3
    Junior Member POOCRACKIN's Avatar
    Computer Details
    POOCRACKIN's Computer Details
    Operating System:
    VISTA
    Using
    AutoCAD 2010
    Join Date
    Nov 2009
    Location
    UNITED STATE OF GEORGIA
    Posts
    11

    Default

    sorry so long on the reply, i'm trying to annotate the code to better show what i'm doing, rename variables, eliminate any unused variables and whatnot while at work god bless the system, ., ., but i will repost soon, hopefully today,., ., ., thank you for the safearray work around., ., i'm still working on the polar issue,,, i added the z coord and there's still issues, i think i changed something else unknowingly, so i'm going back through.
    btw, poo is just a random small number, but small is all relative to the dwg, ha., Point Origin Offset if you will

  4. #4
    Senior Member
    Computer Details
    flowerrobot's Computer Details
    Operating System:
    Windowns 7
    Computer:
    Lenovo W520
    Discipline
    Mechanical
    flowerrobot's Discipline Details
    Occupation
    Cad Manger
    Discipline
    Mechanical
    Using
    Mechanical 2013
    Join Date
    Sep 2007
    Location
    Sydney
    Posts
    384

    Default

    Quote Originally Posted by ollie View Post
    EDIT: variable name POO, c'mon wtf
    Guessing you have never seen my test code before and admin changes it
    Its amazing some of the random variables a 21 y.o. male instantly come up with

    Flower

    (p.s. sorry for not being constructive)

  5. #5
    Junior Member POOCRACKIN's Avatar
    Computer Details
    POOCRACKIN's Computer Details
    Operating System:
    VISTA
    Using
    AutoCAD 2010
    Join Date
    Nov 2009
    Location
    UNITED STATE OF GEORGIA
    Posts
    11

    Smile

    okey dokey pokey, hopefully i have better explained what i'm going for, in the code for the "PolHole" command, i have used the polar command, and i can only get it to work when going from left to right (0 degrees) on my pc.. i checked the "PolarDirection" (user defined) variable which updates flawlessly to whatever angle i pick, but the line doesn't seem to copy and offset the same way...

    out of curiousity, i made the code for the "Hole" command., ., same principles, just took out the "polar" command, scaling and hatch.. but i works at all angles..... for my dear life i cannot figure out why the copy and offset are not going to the seemingly defined angle.

    Code:
    "PolHole" - only works left to right 
    ;;CREATE HOLE SYMBOL IN STEEL CONNECTION PLATE
    
    ;-ERROR HANDLER-
    (defun *ERROR* (MSG)       
    (setvar "OrthoMode" OrthoSetting)  
    (setvar "PolarMode" PolarSetting)  
    (setvar "CmdEcho" 1)      
    (princ MSG)               
    (princ
       )                                                                 
    ); -END DEFUN *ERROR*
    
    ;====================================================================;
    ;             _______ __l_______________________________    or       ;
    ;select      l       l88l88l       to make              l   select   ;
    ;this Line-> l       l88l88l <-hole w/ centerLine       l <-this line;
    ;            l_______l88l88l_________ and_______________l            ;
    ;                       l            hatch thru plate                ;
    ;====================================================================;
    (Defun C:polhole (/ LineRef      OrthoSetting     PolarSetting WidthFromCenter DistanceToCenter
    	       StartPoint   DifferenceX      MidPointX    MidPointY       CopyPointX
    	       EndPoint     StartPointX      StartPointY  EndPointX       EndPointY 
    	       DistanceToMidPointX           DifferenceY  DistanceToMidPointY  
    	       MidPoint     PolarDirection   CopyPoint    OffsetPoint2    OffsetPoint1 
    	       CopyPointY   HatchPointOffset HatchPoint1X HatchPoint2X    HatchPoint1Y
    	       HatchPoint2Y HatchPoint1      HatchPoint2  TotalHoleCopyDistance1
    	       HoleCopyPoint
       )
    (setvar "CmdEcho" 0
       )
    (while (null
    (setq LineRef         ;line to make hole from
          (car (entsel "n\Pick Line length to reference>:"))))
       ) ;end while
    
    (setq OrthoSetting    (GetVar "OrthoMode")                                     
          PolarSetting    (GetVar "PolarMode")                                     
          
          WidthFromCenter (/ (GetDist "\nTYPE WIDTH OF HOLE)") 2)                        
          DistanceToCenter(GetDist "\nTYPE DISTANCE TO CENTER OF HOLE:(")
          
          StartPoint      (cdr (assoc 10 (ENTGET LineRef)))                               
          EndPoint        (cdr (assoc 11 (ENTGET LineRef)))
          StartPointX     (car StartPoint)
          StartPointY     (cadr StartPoint)
          EndPointX       (car EndPoint)
          EndPointY       (cadr EndPoint)
             ) ;end setq
    ;==============================================================;
    ; begin determine midpoint of LineRef                          ;
    ; which is where it will be copied, moved and offset from later;
    ; (I had trouble working from the startpoint, not sure why, but;
    ; but working from the midpoint works fine.)                   ;
    ;==============================================================;
    (if (> EndPointX StartPointX)
      (setq DifferenceX (- EndPointX StartpointX))
      (setq DifferenceX (- StartpointX EndPointX))) ; end if
    
    (setq DistanceToMidPointX (/ (abs DifferenceX) 2)
       )
    
    (if (> EndPointY StartPointY)
      (setq DifferenceY (- EndPointY StartPointY))
      (setq DifferenceY (- StartPointY EndPointY))) ;end if
    
    (setq DistanceToMidPointY (/ (ABS DifferenceY) 2)
       )
    ;===============================================================;
    ;this will determine which direction to apply midpoint distances;
    ;===============================================================;
    (cond ((<= StartpointX EndPointX)(SETQ MidPointX (+ StartpointX DistanceToMidpointX)))
           ((< EndPointX StartpointX)(SETQ MidpointX (+ EndPointX DistanceToMidpointX)))
      )     
    (cond ((<= StartPointY EndPointY)(SETQ MidPointY (+ StartPointY DistanceToMidpointY)))
           ((< EndPointY StartPointY)(SETQ MidPointY (+ EndPointY DistanceToMidpointY)))
      )
    (setq MidPoint (LIST MidPointX MidPointY 0.0) ;added z coordinate
      )
    ;end of figuring midpoint
     
              (SETVAR "PolarMode" 2
    	      )
    (SETQ PolarDirection  (* 180 (/ (GETORIENT "DIRECTION FROM SELECTED LineRef" StartPoint) pi))
          CopyPoint    (polar MidPoint PolarDirection DistanceToCenter)        
          
          OffsetPoint2 (POLAR MidPoint PolarDirection (+ DistanceToCenter WidthFromCenter)) 
          OffsetPoint1 (POLAR MidPoint PolarDirection (- DistanceToCenter WidthFromCenter)) 
          CopyPointX   (CAR CopyPoint)
          CopyPointY   (CADR CopyPoint)
          HatchPointOffset 0.09876
          HatchPoint1X (+ CopyPointX HatchPointOffset)
          HatchPoint2X (- CopyPointX HatchPointOffset)
          HatchPoint1Y (+ CopyPointY HatchPointOffset)
          HatchPoint2Y (- CopyPointY HatchPointOffset)
          HatchPoint1  (List HatchPoint1X HatchPoint1Y)
          HatchPoint2  (List HatchPoint2X HatchPoint2Y) 
           )
    
    ;this will create the hole.. hopefully at any angle  
    
    (COMMAND "MOVE" LineRef "" MidPoint CopyPoint)
    (COMMAND "COPY" LineRef "" CopyPoint MidPoint)
    (COMMAND "OFFSET" WidthFromCenter LineRef OffsetPoint1 "E")
    (COMMAND "OFFSET" WidthFromCenter LineRef OffsetPoint2 "E")  
    (COMMAND "SCALE" LineRef "" CopyPoint "1.5")
    (COMMAND "-HATCH" "P" "SOLID" HatchPoint1 HatchPoint2 ""
       )
    (SETQ SsPointsForHole (LIST (LIST (CAR OffsetPoint1)(CADR OffsetPoint1)) ;point list for crossong poly
    		      (LIST (CAR OffsetPoint2)(CADR OffsetPoint2))       ;at midpoints of all 3 lines 
    		      (LIST CopyPointX CopyPointY))                      ;that make up "Hole"         
          HOLE (SSGET "_CP" SsPointsForHole)      
          HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          HoleCopyPoint(POLAR CopyPoint PolarDirection HoleCopyDistance1)
    	)	    
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint)
    ;==============================================================================;
    ;---this just repeats until i find a snazzy way of repeating it an unspecified ;
    ; number of times                                                              ;
    ;==============================================================================;
    (SETQ HoleDistance2 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 HoleDistance2)
          HoleCopyPoint (POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
      (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
             )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
    (SETQ HoleCopyDistance1 (GETDIST "n\DIST TO NEXT HOLE")
          TotalHoleCopyDistance1(+ HoleCopyDistance1 TotalHoleCopyDistance1)
          HoleCopyPoint(POLAR CopyPoint PolarDirection TotalHoleCopyDistance1)
            )      
    (COMMAND "COPY" HOLE "" CopyPoint HoleCopyPoint
       )
              (SETVAR "PolarMode" PolarSetting)
              (SETVAR "OrthoMode" OrthoSetting)
              (SETVAR "CmdEcho" 1) 
    (PRINC)
    )
    "Hole"- not what i want but works at all angles with about the same variable values..
    Code:
    ;;CREATE HOLE SYMBOL IN STEEL CONNECTION PLATE
    
    ;-ERROR HANDLER-
    (defun *ERROR* (MSG)          
    (setvar "OrthoMode" OrthoSetting)  
    (setvar "PolarMode" PolarSetting)  
    (setvar "CmdEcho" 1)      
    (princ MSG)               
    (princ
       )                                                                 
    ); -END DEFUN *ERROR*
    
    (Defun C:hole (/ LineRef PolarSetting WidthFromCenter DistanceToCenter StartPoint
    	       EndPoint StartPointX StartPointY EndPointX EndPointY DifferenceX
    	       DistanceToMidPointX DifferenceY DistanceToMidPointY MidPointX MidPointY
    	       MidPoint PolarDirection OppPolarDirection HoleSide CopyDist CopyDeg
    	       OppCopyDeg Side1 Side2 MoveStr CopyStr1 HoleSide1Str)
    
    (setvar "CmdEcho" 0
       )
    (while (null
    (setq LineRef (car (entsel "<Pick Line length to reference>:"))));line to make hole from
       ) ;end while
    
    (setq PolarSetting (GetVar "PolarMode")                                     
    
          WidthFromCenter  (/ (GetDist "\nTYPE WIDTH OF HOLE)") 2) ;hole variables
          DistanceToCenter (GetDist "\nTYPE DISTANCE TO CENTER OF HOLE:(")
    
          StartPoint  (cdr (assoc 10 (ENTGET LineRef)));"LineRef" points
          EndPoint    (cdr (assoc 11 (ENTGET LineRef)))
          StartPointX (car StartPoint)
          StartPointY (cadr StartPoint)
          EndPointX   (car EndPoint)
          EndPointY   (cadr EndPoint)
            ) ;end setq
    
    (if (> EndPointX StartPointX)                  ;if "LineRef" moves right from StartPoint
      (setq DifferenceX (- EndPointX StartpointX)) ;do this... if it moves left             
      (setq DifferenceX (- StartpointX EndPointX)) ;do this                                 
        ) ;end if
    (setq DistanceToMidPointX (/ (abs DifferenceX) 2) ;get mid of absolute difference in "x"
       )
    
    (if (> EndPointY StartPointY)                  ;if "LineRef" moves up from StartPoint
      (setq DifferenceY (- EndPointY StartPointY)) ;do this... if it moves down          
      (setq DifferenceY (- StartPointY EndPointY)) ;do this                              
        ) ;end if
    
    (setq DistanceToMidPointY (/ (ABS DifferenceY) 2) ;get mid of absolute difference in "y"
       )
    
    ;this will determine which direction to apply midpoint distances
    
    (cond ((<= StartpointX EndPointX)(SETQ MidPointX (+ StartpointX DistanceToMidpointX)))
           ((< EndPointX StartpointX)(SETQ MidpointX (+ EndPointX DistanceToMidpointX)))
      )     
    (cond ((<= StartPointY EndPointY)(SETQ MidPointY (+ StartPointY DistanceToMidpointY)))
           ((< EndPointY StartPointY)(SETQ MidPointY (+ EndPointY DistanceToMidpointY)))
      )
    (setq MidPoint (LIST MidPointX MidPointY 0.0) 
      );-------------------------------------------end of figuring midpoint
    
    (SETVAR "PolarMode" 2 ;polar on to determine direction to make hole
      )
    ;=================================================================================;
    ;here is a work around for my faulty polar section of my first code, i have       ;
    ;left out the hatching, and the scaling of the centerline in this code. this is   ;
    ;to show an idea of what i would like the "polar" command to do in the first code ;
    ;which is to create the "holes" at any angles my little heart desires.            ;
    ;=================================================================================;
    (setq PolarDirection(* 180(/ (GETORIENT "DIRECTION FROM SELECTED Line" StartPoint) pi))
          OppPolarDirection (- PolarDirection 180)
          HoleSide  (RtoS WidthFromCenter 2)
          CopyDist  (RtoS DistanceToCenter 2)
          OppCopyDeg(RtoS OppPolarDirection 2)
          CopyDeg   (RtoS PolarDirection 2)
          Side1     (RtoS HoleSide1 2)
          Side2     (RtoS HoleSide1 2)            
          MoveStr   (StrCat "@" copydist "<" CopyDeg)
          CopyStr1  (StrCat "@" copydist "<" OppCopyDeg)
          HoleSide1Str (StrCat "@" HoleSide "<" CopyDeg)
          HoleSide2Str (StrCat "@" HoleSide "<" OppCopyDeg)
           )
    (command "move" LineRef "" MidPoint movestr)
    (command "copy" LineRef "" MidPoint copystr1)   
    (command "copy" LineRef "" MidPoint HoleSide1Str)   
    (command "copy" LineRef "" MidPoint HoleSide2Str)
    
    ;=================================================================================;
    ;then i would like to scale the middle line to *1.25 and hatch in between the     ;
    ;outer-most lines, then copy or repeat for multiple "hole" instances              ;
    ;=================================================================================;
    (SETVAR "PolarMode" PolarSetting) ;reset polar
    (setvar "CmdEcho" 1)  
    
    );end defun hole
    two thousand thanks and endless gratitude to anyone who knows what in the infernal hades i have done... yes, i even renamed the "POO"

  6. #6
    Senior Member devitg's Avatar
    Computer Details
    devitg's Computer Details
    Operating System:
    XP
    Monitor:
    VG2021WM VIEW SONIC
    Using
    AutoCAD 2008
    Join Date
    Apr 2005
    Location
    CORDOBA ARGENTINA
    Posts
    107

    Default

    Registered forum members do not see this ad.

    Hi POOCRAKIN, my way to debug , while building a lisp , is to let all variable as GLOBAL , just when it run as spected , I localize it.
    Also I do not use error up I finish the lisp.
    Other , when doing a division , beware to use a REAL as divisor , so if dividen is a INTeger and divisor is too a INTeger the result will be a INT
    (/ 5 2) return 2 , (/ 5 2.0) 2.5 .
    Other tip I use , is to do a setq to each variable.
    As I do not know WHAT are you trying to do, I can not give you further help.
    Could it be possible you upload a sample dwg?
    Gabriel.

Similar Threads

  1. Setting polar in LISP AND VBA but still...
    By Grenco in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 28th Sep 2011, 04:51 am
  2. Polar tracking problems
    By Gibbo-21 in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 25th Nov 2009, 04:36 pm
  3. problems with lisp i think.?.?.?
    By chelsea1307 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 11
    Last Post: 10th Dec 2008, 07:43 pm
  4. polar coordinates do not work the first time the lisp code is invoked...
    By hazardman in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Jul 2007, 11:06 pm
  5. LISP - trimming problems
    By pefi in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 20th Jul 2006, 02:52 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts