Jump to content

Leaderboard

  1. BIGAL

    BIGAL

    Trusted Members


    • Points

      578

    • Content Count

      14,285


  2. Lee Mac

    Lee Mac

    Trusted Members


    • Points

      458

    • Content Count

      20,585


  3. dlanorh

    dlanorh

    Trusted Members


    • Points

      283

    • Content Count

      1,106


  4. ronjonp

    ronjonp

    Trusted Members


    • Points

      242

    • Content Count

      1,782



Popular Content

Showing content with the highest reputation since 08/19/2018 in all areas

  1. 6 points
    Just a note to say thanks for maintaining this site. It's a pleasure to come here, read a question, type out a response and see it instantly appear to help the other user(s). Image attachments via drag+drop work flawlessly too. It is noticed and appreciated. Cheers!
  2. 5 points
    Also the best users, mods and admin!
  3. 5 points
    I agree also great forum, the biggest out there is the worst site and they just dodge around the edges of the problems by saying contact our support request department
  4. 5 points
    Totally inappropriate response Jamin. Good luck with your next CAD problem. The members who have posted in this thread include 2 forum moderators and collectively have a total of about 65,000 posts.
  5. 4 points
    Hi @rkmcswain and all who have commented - thanks for your kind words. It has been a pleasure to keep this forum in good order over so many years (the CADTutor site is 25 years old this year!). Naturally, a forum isn't anything without its members, so I thank you all, in return, for being such a great community who continue to post brilliant content and .give your time freely to help others. Long may it continue!
  6. 4 points
    For what it's worth, here's an existing program to handle elliptical arcs too.
  7. 4 points
    Having a bit of spare time, I thought I would make a hatch pattern similar to the OS marsh block marsh1.pat
  8. 4 points
    Options, User Preferences, Right Click Customization, put a check mark in the upper left box 'turn on time-sensitive right-click. Also look into the system variables added in 2021 so with trim or extend you won't have to use the RMB or hit enter.
  9. 4 points
    Give this a try .. welcome to CadTutor (defun c:foo (/ a d el s) ;; RJP » 2020-05-18 (vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object)))) (cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a)))) ) (if (setq s (ssget "_X" '((0 . "DIMENSION")))) (foreach e (mapcar 'cadr (ssnamex s)) (vlax-for a (vla-item (vla-get-blocks d) (cdr (assoc 2 (setq el (entget e))))) (entmakex (append (entget (vlax-vla-object->ename a)) (list '(8 . "Busted_Dims") '(62 . 8) (assoc 410 el)) ) ) ) ;; Entdel does not work on layouts (vl-catch-all-apply 'vla-delete (list (vlax-ename->vla-object e))) ) ) (foreach l a (vlax-put l 'lock -1)) (princ) ) (vl-load-com)
  10. 4 points
    vla-put-insertionpoint uses early binding meaning that access to the property is defined by the Type Library for the AutoCAD ActiveX Component Object Model (COM), whereas vlax-put-property or the undocumented vlax-put function uses late binding, meaning that access to the property is resolved at run-time. The difference between the late-bound functions vlax-put-property and vlax-put is simply that vlax-put will accept native Vanilla AutoLISP data types, thereby allowing you to supply lists of doubles in place of a safearray variant used by vlax-put-property, however, I've experienced issues in the past when using vlax-put with some properties and so tend to opt for vlax-put-property where possible. The differences between early & late binding become more apparent when interfacing with objects outside of the AutoCAD Object Model, for example, such as the Excel Object Model. Here, unless you import the relevant Type Library to define the properties & methods of objects within the Object Model, you will not be able to access properties or invoke methods using the early-bound vla-get-*/vla-put-* or vla-* functions respectively, but only by referencing the property or method by name using the late-bound vlax-get-property/vlax-put-property or vlax-invoke-method functions (or the equivalent undocumented vlax-get/vlax-put & vlax-invoke functions). In terms of performance, since AutoLISP is interpreted at run-time, you'll only take advantage of the performance benefits of early binding if you compile & optimise your program, and even then, the differences are close to negligible.
  11. 4 points
    While you're waiting, consider that this isn't some magic portal where you ask for something for free and it's delivered to you with a flash of smoke.....
  12. 3 points
    This seems to work: (setvar 'measurement 1) (command "._-SCALELISTEDIT" "_Reset" "_Yes" "_Exit")
  13. 3 points

    Version 1.7.0

    835 downloads

    This program will calculate the total length of Lines/Polylines/LWPolylines/Arcs/Ellipses/Circles/Splines with an optional filter. The Filter may be used to select only those lines that are on a certain layer, or perhaps have a certain linetype or colour. The results of the calculation can be displayed in an ACAD Table within the drawing, or written to either a CSV or TXT File. The Table-Style may be selected from the drop-down in the main dialog. Main interface The main dialogue box allows the user to filter lines by layer, linetype or colour and select the table style. Multiple selected items can filtered. A filter string may be entered to help the user quickly find the filter items that he/she requires. Options The options dialogue box allows the user to specify which object types should be included and the type of output, table in the drawing, CSV file or TXT file. Demo Function Syntax: LenCal For instructions on how to run the program see here. Any comments, criticism and suggestions are welcome. Either PM me directly, or reply to the original thread.
  14. 3 points
    I wasn't aware there were any others. I must get out more!
  15. 3 points
  16. 3 points
    Perhaps this? http://www.lee-mac.com/steal.html
  17. 3 points
    Sounds like you need a new draftsman. Can they explain exactly what the concern is about? Since what I draw on company time belongs to the company, I am required to send what my bosses ask me to send.
  18. 3 points
    Deleting all write-enabled dimensions (i.e. those residing on unlocked layers) from a drawing is relatively straightforward and can be achieved by iterating over the drawing database and deleting all objects whose objectname property matches "AcDb*Dimension*", as the following code demonstrates: (defun c:deldim ( ) (vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (wcmatch (vla-get-objectname obj) "AcDb*Dimension*") (vlax-write-enabled-p obj)) (vla-delete obj) ) ) ) ) (princ) ) (vl-load-com) (princ) The above will remove all dimensions from all layouts & block definitions. However, deleting MText containing specific words isn't quite so easy, as the MText content could potentially be interspersed with MText formatting codes, which would need to be removed prior to testing whether the content contains one of the target words.
  19. 3 points
    You can achieve this using the wildcard not operator ("~") : (sssetfirst nil (ssget "_X" (list '(0 . "TEXT,MTEXT") '(1 . "~*NOTAS PARTICULARES*") (cons 410 (getvar 'ctab))))) However, if you wanted to exclude multiple patterns by separating the patterns using a comma (e.g. "PATTERN1,PATTERN2") you should note that the not operator will only apply to the first wildcard pattern in the delimited string (e.g. "~PATTERN1,PATTERN2" will still include "PATTERN2") : _$ (wcmatch "PATTERN1" "~PATTERN1,PATTERN2") nil _$ (wcmatch "PATTERN2" "~PATTERN1,PATTERN2") T And so if you were looking to exclude multiple patterns, you could use either: (sssetfirst nil (ssget "_X" (list '(0 . "TEXT,MTEXT") '(-4 . "<NOT") '(1 . "PATTERN1,PATTERN2") '(-4 . "NOT>") (cons 410 (getvar 'ctab))))) Or: (sssetfirst nil (ssget "_X" (list '(0 . "TEXT,MTEXT") '(1 . "~PATTERN1") '(1 . "~PATTERN2") (cons 410 (getvar 'ctab))))) Since the filter list for an ssget expression implements an implicit AND logic.
  20. 3 points
    The duplicate elements present in each list make this task slightly trickier than it would otherwise be - here is an alternative solution: (defun f ( a b ) (mapcar '(lambda ( x / z ) (setq z b) (list x (foreach y x (setq z (LM:removeonce y z)))) ) a ) ) (defun LM:removeonce ( x l / f ) (setq f equal) (vl-remove-if '(lambda ( a ) (if (f a x) (setq f (lambda ( a b ) nil)))) l) ) _$ (f a b) ( ((750.0 500.0 500.0) (400.0)) ((750.0 500.0 400.0) (500.0)) ((750.0 500.0 400.0) (500.0)) ((500.0 500.0 400.0) (750.0)) ((750.0 500.0) (500.0 400.0)) ((750.0 500.0) (500.0 400.0)) ((750.0 400.0) (500.0 500.0)) ((500.0 500.0) (750.0 400.0)) ((500.0 400.0) (750.0 500.0)) ((500.0 400.0) (750.0 500.0)) ((750.0) (500.0 500.0 400.0)) ((500.0) (750.0 500.0 400.0)) ((500.0) (750.0 500.0 400.0)) ((400.0) (750.0 500.0 500.0)) )
  21. 3 points
    Use an alphanumerical sorting function to interpret & sort numerical data within the string, rather than sorting character-wise, e.g. to sort layouts alphanumerically, you might use: (defun c:sortlayouts ( / ls1 ls2 ord ) (vlax-for lyt (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (if (= :vlax-false (vla-get-modeltype lyt)) (setq ls1 (cons (strcase (vla-get-name lyt)) ls1) ls2 (cons lyt ls2) ) ) ) (setq ord 0) (foreach idx (LM:alphanumsort-i ls1) (vla-put-taborder (nth idx ls2) (setq ord (1+ ord))) ) (princ) ) ;; Alphanumerical Sort-i - Lee Mac ;; Sorts a list of strings containing a combination of alphabetical & numerical characters and returns the indices. (defun LM:alphanumsort-i ( lst ) (vl-sort-i (mapcar 'LM:splitstring lst) (function (lambda ( a b / x y ) (while (and (setq x (car a)) (setq y (car b)) (= x y) ) (setq a (cdr a) b (cdr b) ) ) (cond ( (null x) b) ( (null y) nil) ( (and (numberp x) (numberp y)) (< x y)) ( (numberp x)) ( (numberp y) nil) ( (< x y)) ) ) ) ) ) ;; Split String - Lee Mac ;; Splits a string into a list of text and numbers (defun LM:splitstring ( str ) ( (lambda ( l ) (read (strcat "(" (vl-list->string (apply 'append (mapcar (function (lambda ( a b c ) (cond ( (or (= 34 b) (= 92 b)) (list 32 34 92 b 34 32) ) ( (or (< 47 b 58) ;(and (= 45 b) (< 47 c 58) (not (< 47 a 58))) (and (= 46 b) (< 47 a 58) (< 47 c 58)) ) (list b) ) ( (list 32 34 b 34 32)) ) ) ) (cons nil l) l (append (cdr l) '(( ))) ) ) ) ")" ) ) ) (vl-string->list str) ) ) (vl-load-com) (princ)
  22. 3 points
    Concrete hatch has for a long time been a disappointment for some. The reason being that people are hatching some concrete in Svalbard in a drawing that has its origin on the equator and using mm as units! When one looks at the hatch definition, the distances and angles are not defined to enough decimal places. So I thought I would try and see if I could do better using trigonometry to calculate the amounts. Non-rational numbers need to be defined to as many decimal places as possible if they are to be used a long way from the origin. But the hatch definition file has a line limit of 80 characters. Any longer than that, and one gets a warning in AutoCAD. Here is the file definition and a picture of the hatch a long way from the origin. Those able enough can copy the file and overwrite the supplied Concrete Hatch. *aaconc, updated concrete hatch (random dot and stone pattern) 50, 0,0, 4.1297503417,-5.8978947189, 0.75,-8.25 355, 0,0, -2.0378120728,7.3723683986, 0.60,-6.6 100.4514447435,.598,-.0523,5.73058713914,-6.93976736215,0.63740192,-7.0114211171 46.1842,0,2,6.19462551259,-8.84684207832,1.125,-12.375 96.6356447435,.889,1.862,8.5958807087,-10.4096510432,0.9561028796,-10.5171316757 351.1842,0,2,7.7432818907,11.0585525979,.9,-9.9 21,1,1.5,4.1297503417,-5.8978947189,0.75,-8.25 326,1,1.5,-2.0378120728,7.3723683986,0.6,-6.6 71.4514447435,1.497,1.164,5.73058713914,-6.93976736215,0.6374019197,-7.011421117 37.5, 0,0, 2.123,2.567, 0,-6.52,0,-6.7,0,-6.625 7.5, 0,0, 3.123,3.567, 0,-3.82,0,-6.37,0,-2.525 -32.5, -2.23,0, 4.6234,2.678, 0,-2.5,0,-7.8,0,-10.35 -42.5, -3.23,0, 3.6234,4.678, 0,-3.25,0,-5.18,0,-7.35 *eldon
  23. 3 points
    The Rectangle command is just a command that creates a 4 sided polygon using the length and width dimensions that you provide. Once the command is finished, you're left with a closed polyline. That's why, when you select the rectangle and look at its properties, it lists the object as a polyline, not a rectangle. So there are no length or width values.
  24. 3 points
    If you like this way then just let me know to write such a working routine for you for free.
  25. 3 points
    This (sub)function is part of a larger appie I'm currently working on (not sure how I'm gonna name the larger app yet , for now called it RlxBlockSync but also entertaining the idea to call RFD, redefine for dummies ) Anyways, this sub dynamically creates a dialog and takes 'commatized' strings for input. Few years ago I wrote Tokkie, this basically does the same , just a little different and with less code. I was inspired by a similar function master L created and later Grrr made something like that. The reason I use commatized / csv strings is so I can save the output of this function as a string in the registry. Added little test function which generates 3 list boxes but you can have as many LB's as you like, the only limitations are your imagination and the width of your monitor. I hope by analyzing the test function (c:t1) you understand how you can use this function. ; multiple input listbox function : mlist = ( ( description1 (labels1) (defaults1) ) ...) (defun milf ( mlist / get_lb_width commatize de-commatize _ufo toggle fn fp dcl lb-width old-props new-props plist tmp out) ; get max strlen from list arguments for milf (defun get_lb_width (l) (apply 'max (mapcar 'strlen (apply 'append (mapcar 'de-commatize (mapcar 'cadr l)))))) ; (commatize '("a" "b" "c")) -> "a,b,c" (defun commatize (l) (apply 'strcat (cdr (apply 'append (mapcar '(lambda (x) (list "," x)) l))))) ; (de-commatize "a,b,c") -> ("a" "b" "c") (defun de-commatize (s / p)(if (setq p (vl-string-search "," s))(cons (substr s 1 p)(de-commatize (substr s (+ p 2))))(list s))) ; use filter on : (_ufo "*" '("door" "table" "floor")) (_ufo "o" '("door" "table" "floor")) (defun _ufo ( f l ) (if (and (= (type f) 'STR) (/= f "")) (vl-remove-if '(lambda (s)(not (or (eq f "*") (vl-string-search (strcase f)(strcase s))))) l))) ; adds / removes [0] or [X] before each item in listboxes (defun toggle (k v / lst r s) (if (eq (substr (setq r (nth (atoi v) (setq lst (cdr (assoc k plist))))) 2 1) "X") (setq s "[O] ") (setq s "[X] ")) (setq plist (subst (cons k (setq lst (subst (strcat s (substr r 5)) r lst))) (assoc k plist) plist)) (start_list k)(mapcar 'add_list lst)(end_list)(set_tile k v)) ; calculated width of list boxes by finding longest string (setq lb-width (+ (get_lb_width mlist) 5)) (if (not (setq fp (open (setq fn (vl-filename-mktemp ".dcl")) "w"))) (princ "\nUnable to create temporary dcl file") (progn (write-line "milf:dialog {label=\"Multiple Input Listbox Function (RLX 5/'20)\";:row {" fp) (setq lb 0) (foreach item mlist (write-line (strcat ":column {label=\"" (car item) "\";:list_box{height=16;width=" (itoa lb-width) ";key=\"lb" (itoa (setq lb (1+ lb))) "\";}}") fp)) (write-line "}ok_cancel;}" fp)(if fp (progn (close fp)(gc))) (if (not (and (< 0 (setq dcl (load_dialog fn))) (new_dialog "milf" dcl))) (princ "\nUnable to start dialog milf") (progn (setq lb 0) (foreach item mlist (setq old-props (de-commatize (cadr item)) new-props (de-commatize (caddr item))) (setq l (mapcar '(lambda (x)(if (member x new-props)(strcat "[X] " x)(strcat "[O] " x))) old-props)) (setq lb-id (strcat "lb" (itoa (setq lb (1+ lb)))) plist (cons (cons lb-id l) plist)) (start_list lb-id) (mapcar 'add_list l) (end_list) (action_tile (strcat "lb" (itoa lb)) "(toggle $key $value)") ) (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (setq drv (start_dialog)) (unload_dialog dcl)(vl-file-delete fn) ) ) ) ) (if (= drv 1) (mapcar '(lambda (x)(commatize (mapcar '(lambda (y)(substr y 5)) x))) (mapcar '(lambda (x)(_ufo "[X]" x))(mapcar 'cdr (reverse plist)))) nil) ) (defun c:t1 ( / result-list animals breakfast music) (setq animals "Aardvark,Baboon,Camel,Dragons,Easterbunny,Firebird,Godzilla,Hobbit,Idiot,Phoenix") (setq breakfast "Anna Nicole,Beyoncé Knowles,Carmen Electra,Daenerys Targaryen,Ella Enchanted,Gal Gadot,Sophie Turner") (setq music "Andrea Bocelli,Electric Light Orchestra,Earth Wind & Fire,George Michael,Lara Fabian,Queen") (setq result-list (milf (list (list "Animals" animals "Dragons,Phoenix") (list "Breakfast" breakfast "Gal Gadot,Sophie Turner") (list "Music" music "Electric Light Orchestra,Lara Fabian") ;;; add as many list as you want limited only by the size of the screen ) ) ) (princ "\n\nYou made the following selections : ") (mapcar '(lambda (label value) (princ (strcat "\n\n" label "\nvalue : " value))) '("Animals :" "Breakfast :" "Music :" ) result-list) (princ "\n\n") (princ) ) I can show you how other app looks , but that's not finished yet (if ever) so will get back to that later Awell... hope I didn't forget any sub functions that are allways loaded automatically on my own pc (autoload & forget) but if so let me know (wouldn't be the first time I forgot something and probably not the last time) happy coding
  26. 3 points
    Sengna, you didn't drag the command bar, you merely stretched it. It is still covering your tabs. It appears that your command line is not docked nor is it locked into place. If it were locked you would not have been able to stretch the command line. If it were docked, it would not cover your tabs. Below are some helpful images. Before trying to move your command bar, click the aforementioned three bars in the lower left of the AutoCad window. Notice the list of selections. There is one called LOCKUI which means Lock User Interface. If it is not checked, you can move your AutoCad window elements including the command line. If it is checked you cannot move any of it. Once you get your command line docked, with the number of lines you need showing, go back and check LOCKUI so it won't move again.
  27. 3 points
    Another one (defun disspacify (str / regexp) (if (setq regexp (vlax-get-or-create-object "vbscript.regexp")) (progn (vlax-put-property regexp 'global actrue) (vlax-put-property regexp 'pattern " +") (vlax-invoke regexp 'replace (vl-string-trim " " str) " ") ) ) ) _$ (disspacify " This is a normal string. ") "This is a normal string." _$ [Edit]: Why not full regular expression... Plus, the dot or comma inside the string needs special treatment: (defun disspacify (str / regexp) (if (setq regexp (vlax-get-or-create-object "vbscript.regexp")) (progn (vlax-put-property regexp 'global actrue) (foreach x '( (" +[.]|[.]" . ". ");"end ." to "end. " (" +[,]|[,]" . ", ");"mid ," to "mid, " (" +" . " ");replace multiple spaces ("^ +| +$" . "");remove start and end space(s) ) (vlax-put-property regexp 'pattern (car x)) (setq str (vlax-invoke regexp 'replace str (cdr x))) ) ) ) ) _$ (disspacify " This is a double sentence ,the other one is not .This is a normal string . ") "This is a double sentence, the other one is not. This is a normal string." _$
  28. 3 points
    another, delta (defun c:tt (/ p1 p2 en obj ) (and (setq p1 (getpoint "Specify point ")) (setq p2 (getcorner p1 "opposite corner ")) (setq en (entmakex (list '(0 . "LINE") (cons 10 p1) (cons 11 p2)))) (setq obj (vlax-ename->vla-object en)) (princ (strcat "\nArea=" (rtos (apply '* (mapcar '(lambda (a b) (+ a (abs b))) '(0 0) (vlax-get obj 'delta) ) ) 2 3 ) " M\U+00B2" ) ) (entdel en) ) (princ) ) WCS
  29. 3 points
    Thanks @Tharwat and @dlanorh and @ hanhphuc Sorry for my late reply The lisps were shown working great and I think beautiful thanks ALL
  30. 3 points
    Dadgad, I may be younger than you but I am 66 and retiring at the end of this week! (May 29,2020) I moved from board drafting in 1988 to AutoCAD V2.6 (R8) and over the years always tried to embrace the new commands and UI while keeping many old school functions. I like a good customized Ribbon and all the contextual tabs. Good luck everyone.
  31. 3 points
  32. 3 points
    just quick written for testing, so no [<-- backspace] function (defun foo ($ n / l k str x) ;;hp:pword 16.04.2020 (terpri) (princ (setq x t str "Password : ")) (while (and x (setq k (grread nil))) (if (and (= (car k) 2) (numberp (setq x (cadr k ))) (< 33 x 127) (< (length l) n) ) (progn (princ (strcat "\r" (setq str (strcat str $)))) (setq l (cons x l)) ) (setq x nil) ) ) (vl-list->string (reverse l)) ) test (defun c:test (/ pw) (if (= "Tharwat" (setq pw (foo "*" 7))) (alert pw) (alert "Sorry!! ask Donald Trump!!") ) (princ) )
  33. 3 points
    LISP is correct in both cases: boundary is LWPOLYLINE or LINE (defun DXF (code en) (cdr (assoc code (entget en)))) ;;;========================================================================= (defun Line (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2)))) (defun Ray (po V) (entmakex (list (cons 0 "RAY") (cons 100 "AcDbEntity") (cons 100 "AcDbRay") (cons 10 po) (cons 11 v) ) ) ) ;;;========================================================================= (defun sysvar-set (lst_setvar / strN var var_oldname n) (setq n 0 lstvar_thiep nil lstValue_thiep nil ) (repeat (/ (length lst_setvar) 2) (setq var (nth n lst_setvar) var_oldname (strcat "oldvar_thiep" (itoa n)) ) (setq lstvar_thiep (append lstvar_thiep (list var))) (set (read var_oldname) (getvar var)) (setq lstValue_thiep (append lstValue_thiep (list (read var_oldname)))) (setvar var (nth (+ n 1) lst_setvar)) (setq n (+ 2 n)) ) ) (defun Get-Area (lst ) (/ (apply '+ (mapcar '(lambda (a b) (- (* (car b) (cadr a)) (* (car a) (cadr b)))) lst (cons (last lst) lst) ) ) 2 ) ) ;;;========================================================================= (defun SYSVAR-RESTORE () (mapcar '(lambda (var value) (setvar var (eval value))) lstvar_thiep lstValue_thiep ) ) ;;;========================================================================= (defun CalcZ (Pt1 Pt2 Pt3 / v w) (setq v (mapcar '- Pt1 Pt2) w (mapcar '- Pt3 Pt2) ) (- (* (car v) (cadr w)) (* (cadr v) (car w))) ) ;;;========================================================================= (defun calcThiep (po1 po2 po3 po4 / bit dis m anpha beta h obj_top poS poE) (setq anpha_org (LM:GetInsideAngle po4 po1 po2) beta_org (LM:GetInsideAngle po1 po2 po3) ) (if (< dt 0) (setq anpha anpha_org beta beta_org ) (setq anpha (- pi anpha_org) beta (- pi beta_org) ) ) (Setq bit (CalcZ po1 po4 po2)) (setq dis (distance po1 po2) ang (angle po1 po2) ) (setq m (+ (/ (cos anpha) (sin anpha)) (/ (cos beta) (sin beta)))) (setq h (abs (/ (- dis (sqrt (abs (- (* dis dis) (* 2 m (abs dt)))))) m))) (cond ((or (and (> bit 0) (> dt 0)) (and (< bit 0) (< dt 0))) (setq po5 (polar po2 (- ang (/ pi 2)) h) po6 (polar po1 (- ang (/ pi 2)) h) ) ) ((or (and (> bit 0) (< dt 0)) (and (< bit 0) (> dt 0))) (setq po5 (polar po2 (+ ang (/ pi 2)) h) po6 (polar po1 (+ ang (/ pi 2)) h) ) ) ) (setq po_in1 (inters po5 po6 po1 po4 nil) po_in2 (inters po5 po6 po2 po3 nil) ) ) (defun makeLWPoly (lst) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) ) (mapcar (function (lambda (p) (cons 10 p))) lst) ) ) ) (defun limS (po1 po2 po3 po4 / objL1 objL2 objR iplist) (line po4 po1) (setq objL1 (vlax-ename->vla-object (entlast))) (line po3 po2) (setq objL2 (vlax-ename->vla-object (entlast))) (cond ((> dt 0) (setq iplist (vlax-safearray->list (vlax-variant-value (vla-intersectwith objL1 objL2 3)) ) ) (vla-delete objL1) (vla-delete objL2) (SETQ A (Get-Area (list po1 po2 iplist po1))) ) ((< dt 0) (ray po4 (mapcar '- po2 po1)) (setq objR (vlax-ename->vla-object (entlast))) (if (null (vlax-invoke objR 'IntersectWith objL2 acExtendNone)) (PROGN (setq iplist (vlax-invoke objR 'IntersectWith objL2 acExtendOtherEntity ) ) (SETQ A (Get-Area (list po1 po2 iplist po4 po1))) ) (PROGN (vla-delete objR) (ray po3 (mapcar '- po1 po2)) (setq objR (vlax-ename->vla-object (entlast))) (setq iplist (vlax-invoke objR 'IntersectWith objL1 acExtendOtherEntity ) ) (SETQ A (Get-Area (list po1 po2 po3 iplist po1))) ) ) (vla-delete objL1) (vla-delete objL2) (vla-delete objR) ) ) (abs A) ) ;;;========================================================================= (defun c:dht (/ ent1_lst ent1 ent2 ent3 po1 po2 po3 po4 ang1 ang2 ang3 dis m lstpo1 lstpo2 lstpo3 lstpo-int1 lstpo-int2 anpha beta pS1 pS2 pS3 pE1 pE2 pE3 h bit obj_top poS poE po_in1 po_in2 prom Alim ) (command "undo" "be") (sysvar-set '("cmdecho" 0 "osmode" 0)) (defun *error* (msg) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (setq dt nil) (acet-ui-status) (sysvar-restore) (command "undo" "en") (princ) ) (or dt (setq dt (getcfg "AppData/trapezoid/area")) (setq dt 1000)) (acet-ui-status (setq prom (acet-str-format "\nEnter Area given for to expand (+S) or to trim (-S) <%1> : " (if (numberp dt) (rtos dt 2 3) dt ) "LOOK AT" ) ) ) (setq olddt dt) (setq dt (getreal prom)) (if (null dt) (setq dt olddt) ) (if (not (numberp dt)) (setq dt (atof dt)) ) (acet-ui-status (setq prom "\nPick a LINE (or LWPOLYLINE) edge for to expand (or to trim) area " ) "LOOK AT" ) (while (OR (NOT (setq ent1_lst (entsel prom))) (NOT (wcmatch (DXF 0 (setq ent1 (car ent1_lst))) "LINE,LWPOLYLINE")) ) (acet-ui-status (setq prom "Pick a LINE is not right, Please pick again") "LOOK AT" ) (prompt prom) ) (acet-ui-status) (cond ((eq (DXF 0 ent1) "LINE") (acet-ui-status (setq prom "\nPick a LINE 1st edge of the trapezoid ") "LOOK AT" ) (while (OR (NOT (setq ent2 (car (entsel prom)))) (NOT (wcmatch (DXF 0 ent2) "LINE")) ) (acet-ui-status (setq prom "Pick a LINE is not right, Please pick again") "LOOK AT" ) (prompt prom) ) (acet-ui-status (setq prom "\nPick a LINE 2nd edge of the trapezoid ") "LOOK AT" ) (while (OR (NOT (setq ent3 (car (entsel prom)))) (NOT (wcmatch (DXF 0 ent3) "LINE")) ) (acet-ui-status (setq prom "Pick a LINE is not right, Please pick again") "LOOK AT" ) (prompt prom) ) (acet-ui-status) (setq po1 (vlax-curve-getStartpoint ent1) ;_bottom edge po2 (vlax-curve-getEndpoint ent1) ) (setq pS2 (vlax-curve-getStartpoint ent2) ;_ 1st side pE2 (vlax-curve-getEndpoint ent2) ) (setq pS3 (vlax-curve-getStartpoint ent3) ;_ 2nd side pE3 (vlax-curve-getEndpoint ent3) ) (cond ((Equal po1 ps3 1e-2) (setq po4 pE3) (cond ((Equal po2 ps2 1e-2) (setq po3 pE2)) ((Equal po2 pE2 1e-2) (setq po3 pS2)) ) ) ((Equal po1 pE3 1e-2) (setq po4 pS3) (cond ((Equal po2 ps2 1e-2) (setq po3 pE2)) ((Equal po2 pE2 1e-2) (setq po3 pS2)) ) ) ((Equal po1 ps2 1e-2) (setq po4 pE2) (cond ((Equal po2 ps3 1e-2) (setq po3 pE3)) ((Equal po2 pE3 1e-2) (setq po3 pS3)) ) ) ((Equal po1 pE2 1e-2) (setq po4 pS2) (cond ((Equal po2 ps3 1e-2) (setq po3 pE3)) ((Equal po2 pE3 1e-2) (setq po3 pS3)) ) ) ) ) ((eq (DXF 0 ent1) "LWPOLYLINE") (setq po_pick (cadr ent1_lst)) (setq po_closest (vlax-curve-getClosestPointTo ent1 po_pick)) (setq para1 (fix (vlax-curve-getParamatpoint ent1 po_closest))) (setq paraE (vlax-curve-getEndParam ent1)) (setq paraS (vlax-curve-getStartParam ent1)) (setq po1 (vlax-curve-getPointAtParam ent1 para1)) (cond ((= para1 0) (setq po4 (vlax-curve-getPointAtParam ent1 paraE) po2 (vlax-curve-getPointAtParam ent1 (+ para1 1)) po3 (vlax-curve-getPointAtParam ent1 (+ para1 2)) ) (if (equal po1 po4 1e-3) (setq po4 (vlax-curve-getPointAtParam ent1 (- paraE 1))) ) ) ((< (1+ para1) paraE) (setq po4 (vlax-curve-getPointAtParam ent1 (- para1 1)) po2 (vlax-curve-getPointAtParam ent1 (+ para1 1)) po3 (vlax-curve-getPointAtParam ent1 (+ para1 2)) ) ) ((= (1+ para1) paraE) (setq po4 (vlax-curve-getPointAtParam ent1 (- para1 1)) po2 (vlax-curve-getPointAtParam ent1 (+ para1 1)) po3 (vlax-curve-getPointAtParam ent1 paraS) ) (if (equal po2 po3 1e-3) (setq po3 (vlax-curve-getPointAtParam ent1 (+ paraS 1))) ) ) ) ) ) (setq Alim (limS po1 po2 po3 po4)) (calcThiep po1 po2 po3 po4) (setvar "cecolor" "1") (makeLWPoly (list po1 po2 po_in2 po_in1 po1)) (setvar "cecolor" "256") (if (> (abs dt) Alim) (cond ((> (+ anpha_org beta_org) pi) (alert (acet-str-format "area to expand is too large (max = %1), so this case results in an area error" (rtos Alim 2 3) ) ) ) ((< (+ anpha_org beta_org) pi) (alert (acet-str-format "area to trim is too large (max = %1), so this case results in an area error" (rtos Alim 2 3) ) ) ) ) ) (setcfg "AppData/trapezoid/area" (rtos dt 2 3)) (SYSVAR-RESTORE) (command "undo" "en") (princ "ok") (princ) ) (defun LM:GetInsideAngle ( p1 p2 p3 ) ( (lambda ( a ) (min a (- (+ pi pi) a))) (rem (+ pi pi (- (angle p2 p1) (angle p2 p3))) (+ pi pi)) ) ) Extend_Trim_Area(DHT).lsp
  34. 3 points
    Quick test and setting the DIMBLK variable as pointed out by @eldon imports the appropriate block. Maybe something like this: (defun _importarrowheadblock (n) (or (tblobjname "block" n) (= 'str (type (vl-catch-all-apply 'setvar (list "DIMBLK" n))))) ) (if (_importarrowheadblock "_BOXFILLED") (vla-put-arrowsymbol newleaderstyle "_BOXFILLED") )
  35. 3 points
    The above could alternatively be written: (defun LM:data->xdata ( x ) (cond ( (= 'str (type x)) (list (cons (if (handent x) 1005 1000) x))) ( (= 'real (type x)) (list (cons 1040 x))) ( (= 'int (type x)) (list (cons (if (< -32769 x 32768) 1070 1071) x))) ( (= 'list (type x)) (append '((1002 . "{")) (apply 'append (mapcar 'LM:data->xdata x)) '((1002 . "}")))) ( (list (cons 1000 (vl-prin1-to-string x)))) ) )
  36. 3 points
  37. 3 points
    Neither file (DWG / DXF) appear to have a coordinate system assigned. Command: CGEOCS That should echo the assigned name. You need to assign a known system to the drawing using ... Command: ADESETCRDSYS
  38. 3 points
    Hello All, The CADTutor website will be moving to a new web host shortly and I thought it best to give you advanced warning. Although the moving of files from one server to another can be done quite quickly, there is always a delay while DNS propagation takes place, so and it's likely that this forum will be closed for around two days (hopefully less) while the migration takes place. The rest of the site will remain available during migration. Other than the temporary closure of the forum, you shouldn't notice any other changes except that (hopefully) the site will appear more responsive. I don't yet have a firm timescale for this but it's likely to take place in the next two weeks. I'll update this thread once I know more details.
  39. 3 points
    Firstly, as requested within the terms on my site, I would prefer if programs were referenced by name or using a simple link to the original, rather than posting the entirety of the code on another site and would therefore appreciate if you edited your post to remove the quoted code. Regarding automatically enabling the program on drawing startup: this may be achieved using any of the methods I describe here; I would personally suggest that you create an AutoLISP file with the filename acaddoc.lsp saved within a trusted AutoCAD support file search path (or modify such file if it already exists), and populate this file with a load expression such as: (load "LayerDirectorV1-9.lsp" nil) Assuming that my Layer Director program has also been saved to a trusted AutoCAD support file search path.
  40. 3 points
    You can use my existing Quick Field program for this task, defining a custom command such as: (defun c:tcopy ( ) (LM:quickfield "Textstring" "" 1))
  41. 3 points
    Remove the semicolon before the path to LISP. It's only for separating the paths and since LISP is the first one it shouldn't be there. If you simply moved the semicolon to the end of each path you wouldn't need the last ";" at the end.
  42. 3 points
  43. 3 points
    Thanks both! There is also my Justify Block Base Point for exactly this task.
  44. 3 points
    looks like we must have a serious discussion about the definition of 'fun'
  45. 3 points
    Hi Tony, Don't get me wrong, but you don't seem to have enough experience. Where experience != knowledge. Judging by your requests from your posts, all of them can be done with AutoLISP. Here are two examples to create a simple line - AutoLISP : (setq p1 '(5. 5. 0)) (setq p2 '(12. 3. 0.)) (entmakex (cons '(0 . "LINE") (mapcar 'cons '(10 11) (list p1 p2)))) C# (.NET) /source/ : using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; [CommandMethod("AddLine")] public static void AddLine() { // Get the current document and database Document acDoc = Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDoc.Database; // Start a transaction using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; // Create a line that starts at 5,5 and ends at 12,3 using (Line acLine = new Line(new Point3d(5, 5, 0), new Point3d(12, 3, 0))) { // Add the new object to the block table record and the transaction acBlkTblRec.AppendEntity(acLine); acTrans.AddNewlyCreatedDBObject(acLine, true); } // Save the new object to the database acTrans.Commit(); } } Its true that AutoLISP is limited (although I don't know by how much and at which aspects), but as you can see its alot simplier to use, shorter and easier to maintain. I only know one huge drawback that is within the DCL dialogs (not enough event handlers for the tiles/controls.. like mouse_hover / mouse_leave ), so you can't be that fancy in there. But as long you get the job done, who cares ? I have this real-life friend that brags about learning the powerful language C#, but also null experience (and doesn't seem that he's about to sit and write some actual code). So when I ask, Q: Ok so what you are able to do with it? A: IDK, but I've heard many things can be done in C# Q: Check out this TicTacToe code I wrote in C# A: Sorry, but I don't understand it and I get lost at it (reason is because when one doesn't practice, isn't able to follow any code's algorithm) So the answer is short - open up that Notepad++/VLIDE/Visual Studio and start to practice, so you'll build your own opinion (and it will change quite few times).
  46. 3 points
    In fact my intention was simple, in order to clean up the [BBcodes] within the new code tags in this forum. Therefore, IMO optimized with CLIPBOARD without using 'getfiled' is much more convenient, isn't it? code updated - post#1 Copy text (from forum) -> run 'FORUM' (in ACAD) -> [Ctrl+V] Paste (in forum active editor) Done!
  47. 3 points
    For anyone wanting to find out more about Bricscad here is a link to hundreds of short 2 or 3 minute tutorial videos each covering different topics 2d-drafting 3d-modeling learn-bim customization drawing installation-licensing interface images mechanical printing-plotting programming sheetmetal learn-shape There is also a series of books offered freely that cover Bricsacd BricsCAD for AutoCAD users (348 pages) Inside BricsCAD V18 (386 pages) Customizing BricsCAD V18 (590 pages) There is a complete training course covering the basics which is apparently over 36 hours of content from “Ron Myers - Summit Learning & Technology” which looks to be free as well, though you do have to register. And quite a few blogs are now covering Bricscad https://blog.bricsys.com/ https://blog.bricsys.com/category/topics/heidis-blog/ https://www.cadnauseam.com/2018/07/31/a-b-tip-1-clean-slate/ http://www.cadalyst.com/cad/bricsys-we’re-not-holding-back-dwg-part-1-37431 For anyone wanting to try out the program here are links to download a 30-day trial https://www.bricsys.com/en-intl/bricscad/ https://www.bricsys.com/en-intl/bim/ https://www.bricsys.com/en-intl/sheetmetal/ Bricscad also has a free program called Shape which gives you the chance to build models using the same tools as are found in the full program. It's a really good way to try out all the 3D modeling tools. Without the 30 day limit The file format is DWG just the same as all the other flavours of Bricscad so if you are doing an initial sketch or developing a complete drawing package in Bricscad, turning your model into a BIM model or using the sheetmetal upgrade, it always remains the same DWG file, with the same commands https://www.bricsys.com/en-intl/shape/ And if you come across a problem with the program or even have ideas to improve it then there is always support, and any questions here are sent directly to the people developing the program.
  48. 3 points
    A few minutes ago, I tried to drag & drop a *.png image to a thread response. The result was that my image appeared to open in a web based image viewer, and the "window" I was in had no forum navigation controls except the back arrow on the header, which would only take me back to my unread topics list. And that wiped out the post I was going to make completely. I will try and duplicate the error here. I will copy this message and paste it in a new post if the error occurs and add further info if there is any. Here goes... OK, I figured out how it happens. If you drop the image file anywhere else other than the drop "box" while it is highlighted and wrapped in a dashed line. the image opens in a new window with the LOCAL file name as the web address. If one is careful and doesn't get lost in the fog of "How in the @#$% did this happen?", one can get back to the postable message by closing the extra window before hitting anything else. Is the cause simply that I am too old and befuddled to do this computer stuff any more? More edit. Oh my. It is me. The image opens in a viewer when dragged to ANY webpage and dropped in empty space. I have been using computers since 1982 and have never even done this action one time before. I didn't even know it would happen. Can someone bring me some hot cocoa and a blankie? I'll be here in my rocking chair by the fireplace.
  49. 3 points
    I guess once people get used to it and realize what it is and what it's for, they will start using it, but right now I don't really see it happening. I've been pretty active the last few days, helping out where I can, but my rep count doesn't show it. People say thank you but don't click the button.
  50. 3 points
    I like a dark version as well. I have an add-on called "Dark Reader" in my browser and using it's default settings I get this.....
  • Newsletter

    Want to keep up to date with all our latest news and information?
    Sign Up
×
×
  • Create New...