Quick Search for:  in language:    
Dimension,Leader,function,enhancement,over,Au
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
LISP Stats

 Code: 6,703. lines
 Jobs: 7. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for LISP.
There is currently no new code. Please check back soon.
Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

DL.lsp

Print
Email
 
VB icon
Submitted on: 6/26/2002 11:56:40 PM
By: Terry Miller  
Level: Advanced
User Rating: By 2 Users
Compatibility:Auto Lisp

Users have accessed this code 2842 times.
 

(About the author)
 
     Dimension Leader function that is an enhancement over the AutoCAD's Leader command. The user picks the leader from and to points, and then fills in the Mtext information. The function adjusts the leader to align with the top line of the Mtext, using the user's selected points.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    ;**************************************
    ; Name: DL.lsp
    ; Description:Dimension Leader function 
    ;     that is an enhancement over the AutoCAD'
    ;     s Leader command. The user picks the lea
    ;     der from and to points, and then fills i
    ;     n the Mtext information. The function ad
    ;     justs the leader to align with the top l
    ;     ine of the Mtext, using the user's selec
    ;     ted points.
    ; By: Terry Miller
    ;
    ;This code is copyrighted and has    ; limited warranties.Please see http://w
    ;     ww.Planet-Source-Code.com/vb/scripts/Sho
    ;     wCode.asp?txtCodeId=37&lngWId;=13    ;for details.    ;**************************************
    
    ;---------------------------------------
    ;     ----------------------------------------
    ;     
    ; Program Name: DL.lsp
    ; Created By:Terry Miller (Email: terryc
    ;     ad@airmail.net)
    ;http://web2.airmail.net/terrycad
    ; Date Created: 1-1-01
    ; Function: Dimension Leader function th
    ;     at is an enhancement over the
    ;AutoCAD's Leader command. The user pick
    ;     s the leader from and to
    ;points, and then fills in the Mtext inf
    ;     ormation. The function
    ;adjusts the leader to align with the to
    ;     p line of the Mtext,
    ;using the user's selected points.
    ;---------------------------------------
    ;     ----------------------------------------
    ;     
    ; Revision History
    ; Rev By DateDescription
    ;---------------------------------------
    ;     ----------------------------------------
    ;     
    ; 0TM1-1-01Initial version
    ;---------------------------------------
    ;     ----------------------------------------
    ;     
    (defun c:DL (/ Clayer$ Cnt# DimTad# DScale~ EntList@ LeadAng~ Mid$ New@ Num#
    Old@ Pt1@ Pt2@ Pt3@ SS& Text$ X1~ X2~
    );variables
    (defun dtr (Deg~) (* pi (/ Deg~ 180.0)))
    (setvar "CMDECHO" 0)
    (princ "\nDIM Leader")
    (if (= (getvar "DIMSCALE") 0)
    (setq DScale~ 1)
    (setq DScale~ (getvar "DIMSCALE"))
    );if
    (setq Clayer$ (getvar "CLAYER"))
    ;(command ".LAYER" "M" "DIM" "C" "2" "" 
    ;     "");Change to your Dim layer info.
    (setq Pt1@ (getpoint"\nFrom point: "))
    (princ "\nTo point: ")
    (command ".LEADER" Pt1@ pause ^c)
    (setq Pt2@ (getvar "LASTPOINT"))
    (setq X1~ (car Pt1@))
    (setq X2~ (car Pt2@))
    (if (>= X2~ X1~)
    (setq Pt3@ (polar Pt2@ 0 (* DScale~ (getvar "DIMASZ"))))
    (setq Pt3@ (polar Pt2@ pi (* DScale~ (getvar "DIMASZ"))))
    );if
    (setq DimTad# (getvar "DIMTAD"))
    (setvar "DIMTAD" 0)
    (setq LeadAng~ (angle Pt1@ Pt2@))
    (if (or (< LeadAng~ (dtr 18.4)) (> LeadAng~ (dtr 341.6))
    (and (< LeadAng~ (dtr 198.4)) (> LeadAng~ (dtr 161.6))))
    (if (= (substr (getvar "ACADVER") 1 2) "14")
    (command ".LEADER" Pt1@ Pt2@ Pt3@ "" "" "")
    (command ".LEADER" Pt1@ Pt2@ Pt3@ "" "" "" "")
    );if
    (if (= (substr (getvar "ACADVER") 1 2) "14")
    (command ".LEADER" Pt1@ Pt3@ "" "" "")
    (command ".LEADER" Pt1@ Pt3@ "" "" "" "")
    );if
    );if
    (if (setq SS& (ssget "L" '((0 . "MTEXT"))))
    (progn
    (setq EntList@ (entget (ssname SS& 0)))
    (setq Cnt# 1 Num# 0 Text$ (cdr (assoc 1 EntList@)))
    (repeat (strlen Text$)
    (setq Mid$ (substr Text$ Cnt# 2))
    (if (= Mid$ "\\P")
    (setq Num# (1+ Num#))
    );if
    (setq Cnt# (1+ Cnt#))
    );repeat
    (repeat Num#
    (setq Text$ (strcat "\\P" Text$))
    );repeat
    (setq Old@ (assoc 1 EntList@))
    (setq New@ (cons 1 Text$))
    (entmod (subst New@ Old@ EntList@))
    );progn
    );if
    (command ".LAYER" "S" Clayer$ "")
    (setvar "DIMTAD" DimTad#)
    (princ)
    );defun c:DL
    ;---------------------------------------
    ;     ----------------------------------------
    ;     
    (princ);End of DL.lsp


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/3/2002 2:56:43 PM:Scott
Easy to use and more user friendly than 
the standard AutoCAD leader command.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | LISP Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.