+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
  1. #1
    Full Member
    Using
    not specified
    Join Date
    Aug 2006
    Location
    Lancashire
    Posts
    28

    Default Entering a start point for the DIVIDE command.

    I have drawn a polyline for a bolt hole pattern on an irregular shaped flange. Using the DIVIDE command I can create all the points neccessary for the holes, however the holes do not start in the place that I would like and the consequence is that one of the bolts enters a water gallery. Please can anyone tell me how to tell the command where to start dividing from so that I don't have this problem. Thanks.

  2. #2
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Make a copy of your polyline and _trim or _break at wanted start point.

    I also can offer for you my lisp program which can divide any curves (lines, polylines, splines, circles ellipses) to any nonequal (or equal) distances from specified point.

  3. #3
    Full Member
    Using
    not specified
    Join Date
    Aug 2006
    Location
    Lancashire
    Posts
    28

    Default

    Thanks ASMI, a copy of your LISP routine would greatly appreciated, meanwhile I'll give your solution a try. Thanks again....Mike

  4. #4
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Ok. I need a few time for translation all messages in it to English. I think you get it tomorrow.

  5. #5
    Full Member
    Using
    not specified
    Join Date
    Aug 2006
    Location
    Lancashire
    Posts
    28

    Default

    Thanks ASMI, as and when you are ready will be just fine,....Mike

  6. #6
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    I promised to translate on English my program of markup lines, polylines, splines etc. to various long distances. But when I have looked at the terrible code of two-year-old prescription to translate at me has disappeared. I have decided to write the new program. I think this preliminary variant to you already approaches.

    It while marks the closed contours only up to an start/end point and does not insert blocks. Today simply has not had time to make it.

    Code:
    (defun c:xdiv(/ *error* cCurve curPt dPar dPt
    	      enPt fPar fPt maxLen obType oldDis
    	      oldOsn posDir rClose sFlag stPt
    	      sumDis swMod undoLst vClose whatDo)
    
      (vl-load-com)
    
      (defun asmi_GetActiveSpace(/ actDoc)
        (if
          (= 1(vla-get-ActiveSpace
    	    (setq actDoc
    		   (vla-get-ActiveDocument
    	      (vlax-get-acad-object)
    	      ); end vla-get ActiveSpace
    	     ); end setq
    	    ); end vla-get-ActiveDocument
    	 ); end =
          (vla-get-ModelSpace actDoc)
          (vla-get-PaperSpace actDoc)
          ); end if
        ); end of asmi_GetActiveSpace
    
      (defun RestorePointStyle()
        (if
          (and xdiv:oldPm xdiv:oldPs)
          (progn
    	(initget "Yes No")
    	(setq swMod
    	     (getkword
    	       "\nRestore point style? [Yes/No] <No>: "))
    	(if(null swMod)(setq swMod "No"))
    	(if
    	 (= swMod "Yes")
    	  (progn
    	    (princ "\nPlease wait... \n")
    	    (setvar "PDMODE" xdiv:oldPm)
    	    (setvar "PDSIZE" xdiv:oldPs)
    	  ); end progn
    	 ); end if
    	); end progn
          ); end if
    	(princ)
          ); end of RestorePointStyle
    
      (defun AddPointOrInsert(Mode Block Scale)
        (vla-AddPoint
    		(asmi_GetActiveSpace)
    			    (vlax-3d-point curPt))
        ); end of AddPointOrInsert
    
      (defun AddPointOrInsert(Mode Block Scale / outObj)
        (setq undoLst
         (append
          (list
    	(list
    	 (setq outObj
    	   (vla-AddPoint
    		(asmi_GetActiveSpace)
    			    (vlax-3d-point curPt))); end setq
    	  curPt xdiv:curDis
    	); end list
           ); end list
             undoLst); end append
    	 ); end setq
        outObj
        ); end of AddPointOrInsert
    
      (defun *error*(msg)
        (if cCurve
          (progn
    	 (vla-Highlight cCurve :vlax-false)
    	   (setvar "OSMODE" oldOsn)
    	  ); end progn
    	); end if
         (princ "\n*Cancel*")
        (princ)
        ); end of *error*	 
      (if
        (member
          (setq xdiv:oldPm(getvar "PDMODE"))
          '(0 1)
          ); end member
        (progn
          (setq xdiv:oldPs(getvar "PDSIZE"))
          (initget "Yes No")
          (setq swMod
    	     (getkword
    	       "\nChange points style to good visible? [Yes/No] <Yes>: "))
          (if(null swMod)(setq swMod "Yes"))
          (if
    	(= swMod "Yes")
    	 (progn
    	   (princ "\nPlease wait... \n")
    	   (setvar "PDMODE" 35)
    	   (setvar "PDSIZE" -2)
    	  ); end progn
    	); end if
          ); end progn
        ); end if
      (setq oldOsn
    	 (getvar "OSMODE")); end setq
      (if
        (not xdiv:curDis)
          (setq xdiv:curDis 1.0
    	    xdiv:oldDis 1.0); end setq
          ); end if
      (if
         (setq cCurve
    	   (entsel
    	       "\nSelect curve > ")); end setq
        (progn
          (setq cCurve
    	     (vlax-ename->vla-object
    	       (car cCurve))); end setq
          (if
    	(member
    	  (setq obType
    		 (vla-get-ObjectName cCurve))
    	  '("AcDbLine" "AcDbPolyline" "AcDb3dPolyline"
    	    "AcDbSpline" "AcDbArc" "AcDbCircle" "AcDbEllipse")
    	  ); end member
    	(progn
    	  (vla-Highlight cCurve :vlax-true)
    	  (setvar "OSMODE" 3071)
    	  (setq stPt
    		(vlax-curve-GetStartPoint cCurve)
    		enPt
    		(vlax-curve-GetEndPoint cCurve)
    		fPt
    		 (getpoint
    		   "\nPick start markup point at curve > ")
    		); end setq
    	  (if fPt
    	     (setq fPt(trans fPt 1 0)
    	           curPt(vla-AddPoint
    			  (asmi_GetActiveSpace)
    			    (vlax-3d-point fpt)); end vla-AddPoint
    		   undoLst
    		    (list
    		      (list curPt 0.0 0.0)); end list
    		   ); end setq
    	    ); end if
    	  (if
    	    (and
    	      fPt
    	      (setq fPar
    		     (vlax-curve-GetParamAtPoint cCurve fPt))
    	      ); end and
    	    (progn
    	      (if
    		(and
    		  (not(equal fPt stPt 0.0001))
    		  (not(equal fPt enPt 0.0001))
    		  ); end or
    		(progn
    		  (setq dPt
    			 (getpoint fPt
    			   "\nPick point at curve to specify markup direction > "))
    		  (if dPt
    	            (setq dPt(trans dPt 1 0))); end if
    		  (if
    		    (and
    		      dPt
    		      (setq dPar
    			     (vlax-curve-GetParamAtPoint cCurve dPt))
    		     ); end and
    		    (progn
    		      ); end progn
    		      (princ "\nEmpty input or point not at curve! ")
    		    ); end if
    		  ); end progn
    		); end if
    	      ); end progn
    	    (princ "\nEmpty input or point not at curve! ")
    	    ); end if
    	  ); end progn
    	(princ "\nInvalid object type! ")
    	); end if
          (setq maxLen
    	     (-
    	       (vlax-curve-GetDistAtPoint cCurve enPt)
    	       (vlax-curve-GetDistAtPoint cCurve stPt)
    	       ); end -
    	    rClose
    	     (vlax-curve-IsClosed cCurve)
    	    ); end setq
          (if(equal fPt stPt 0.0001)
    	(setq vClose T)
    	); end if
          (if
    	(or
    	  (equal fPt stPt 0.0001)
    	  (and
    	    dPar
    	    (> dPar fPar)
    	    ); end and
    	  ); end or
    	(setq posDir T
    	      sumDis
    		 (vlax-curve-GetDistAtPoint cCurve fPt)
    	      ); end setq
    	(setq sumDis
    	       (- maxLen
    		(- maxLen
    		 (vlax-curve-GetDistAtPoint cCurve fPt)))
    	      ); end setq
    	); end if
          	      (while(not sFlag)
    		(setq whatDo
    		       (getstring
    			 (strcat
    			 "\nSpecify distance or [Undo/Quit] <"
    			 (if xdiv:curDis(rtos xdiv:curDis) "not defined")
    			   ">: "); end strcat
    			 ); end getstring
    		      ); end setq
    		(cond
    		  ((or
    		     (= 'REAL(type(distof whatDo)))
    		     (= "" whatDo)
    		     ); end or
    		   (if(= "" whatDo)
    		     (setq xdiv:curDis xdiv:oldDis)
    		     (setq xdiv:curDis(distof whatDo))
    		     ); end if
    		   (setq xdiv:oldDis xdiv:curDis); end setq
    		   	(cond
    			  (posDir
    			     (setq sumDis
    				    (+ sumDis xdiv:curDis)
    				   curPt
    				    (vlax-curve-GetPointAtDist cCurve sumDis)
    				   ); end setq
    			     (if curPt
    			       (AddPointOrInsert nil nil nil)
    			       (princ "\n>>> End of line <<< ")
    			          ); end if
    			     ); end condition # 1
    			  ((not posDir)
    			     (setq sumDis
    				    (- sumDis xdiv:curDis)
    				   curPt
    				    (vlax-curve-GetPointAtDist cCurve sumDis)
    				   ); end setq
    			     (if curPt
    			       (AddPointOrInsert nil nil nil)
    			       (princ "\n>>> End of line <<< ")
    			          ); end if
    			     ); end condition # 1
    			  ); end cond
    		   ); end condition #1
    		  ((=(strcase whatDo) "Q")
    		   (if
    		     (= 1(length undoLst))
    		      (vla-Delete(caar undoLst))
    		     ); end if
    		   (RestorePointStyle)
    		   (if cCurve
    	            (progn
    	             (vla-Highlight cCurve :vlax-false)
    	              (setvar "OSMODE" oldOsn)
    	            ); end progn
    	           ); end if
    		   (setq sFlag T)
    		   )
    		  ((=(strcase whatDo) "U")
    		   (if
    		     (and
    		       undoLst
    		       (/= 1(length undoLst))
    		       ); end and
    		     (progn
    		      (vla-Delete(caar undoLst))
    		      (setq undoLst(cdr undoLst)
    			    curPt(cadar undoLst)
    			    sumDis(- sumDis
    				     (last
    				       (car undoLst)))
    			    ); end setq
    		      ); end progn
    		     (princ "\n>>> Nothing to undo <<< ")
    		     ); end if
    		   )
    		  ); end cond
    		); end while
          ); end progn
        (princ "\nEmpty selection! ")
        ); end if
     
      (princ)
      ); end of xdiv
    Text screen listing:
    Code:
    Command: xdiv
    
    Change points style to good visible? [Yes/No] <Yes>:
    
    Please wait...
    Regenerating model.
    Regenerating model.
    
    Select curve >
    Pick start markup point at curve >
    Pick point at curve to specify markup direction >
    Specify distance or [Undo/Quit] <2000.0000>: 4000
    
    Specify distance or [Undo/Quit] <4000.0000>:
    
    Specify distance or [Undo/Quit] <4000.0000>: 2000
    
    Specify distance or [Undo/Quit] <2000.0000>: 500
    
    Specify distance or [Undo/Quit] <500.0000>:
    
    Specify distance or [Undo/Quit] <500.0000>:
    
    Specify distance or [Undo/Quit] <500.0000>:
    
    Specify distance or [Undo/Quit] <500.0000>:
    
    Specify distance or [Undo/Quit] <500.0000>:
    
    >>> End of line <<<
    Specify distance or [Undo/Quit] <500.0000>: q
    
    Restore point style? [Yes/No] <No>:
    And result picture:
    Attached Images

  7. #7
    Full Member
    Computer Details
    Designer's Computer Details
    Operating System:
    Mac
    Computer:
    MacBook Pro
    CPU:
    i7 2.9
    RAM:
    8 Gb
    Primary Storage:
    750Gb
    Discipline
    Architectural
    Designer's Discipline Details
    Occupation
    Drafter
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Nov 2006
    Location
    Portugal
    Posts
    96

    Default

    ASMI Why don`t you make a website with your codes so we can use some
    I can arrange you some space.

  8. #8
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    >Designer

    Thanks for your offer. I already thought of it. I can write HTML and CSS a code in Notepad both by means of Micromedia and I do not have problems with space for own site. However it would seem to me that more useful to place some programs in section AutoLISP Archive on this site. It is difficult to me to tell why this section replenishes extremely seldom. At a forum is lisps worthy is there. Can some doubts with an owning of copyrights to a part or all code? However it is not my I site and I have not the right to discuss it.

    >To all lisp-programmers or shout of my soul

    I do not understand those people which publish the open lisp-code and write that it it is impossible to modify or use its parts in other programs. An another matter of the reference addressed to the author. I do not read such code to not connect my mind with it alhorithm and to not repeat it subconsciously. And sometimes it is done for very banal and uninteresting code. Hide your code, compile it in *.fas or *.vlx. What for you publish in the open kind if it cannot be use in other programs or modified?

    By the way, one French company long time tries to patent smell of wild strawberry. That all who manufacture out products with a smell of wild strawberry paid to its owners. They that have invented this smell?

    >steamwise

    I still should add some useful options in the program and correct lacks. I shall make it in the near future. At this forum I have one more not executed obligation. I all over again should execute it.

  9. #9
    Full Member
    Using
    not specified
    Join Date
    Aug 2006
    Location
    Lancashire
    Posts
    28

    Default A big thanks.

    Thank you ASMI for taking the time and trouble to compile this impressive code. I have successfully used your previous recommendation but this looks the business. Cheers.

  10. #10
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Registered forum members do not see this ad.

    It no need to compile. See http://www.cadtutor.net/forum/showthread.php?t=1390 . I want to end this code at next week. But you already can to use it.
    Last edited by ASMI; 2nd Feb 2007 at 11:30 am.

Similar Threads

  1. Copy Divide
    By boofredlay in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 21
    Last Post: 26th Mar 2008, 12:23 pm
  2. AutoCad command line on specify next point
    By Otaku Ichise in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 4th Jan 2007, 02:18 pm
  3. Selecting an edge/work point from command line
    By devouring in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 10th Oct 2006, 06:24 pm
  4. Divide and Measure
    By CAD-e-Corner in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 12th Sep 2006, 11:40 pm
  5. Windows System Command start vs startapp
    By ImaJayhawk in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 26th Feb 2004, 09:03 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