Jump to content

Leaderboard

  1. BIGAL

    BIGAL

    Trusted Members


    • Points

      25

    • Content Count

      14,285


  2. ronjonp

    ronjonp

    Trusted Members


    • Points

      20

    • Content Count

      1,782


  3. Tharwat

    Tharwat

    Trusted Members


    • Points

      20

    • Content Count

      6,959


  4. Lee Mac

    Lee Mac

    Trusted Members


    • Points

      18

    • Content Count

      20,585



Popular Content

Showing content with the highest reputation since 03/21/2021 in all areas

  1. 3 points
    This seems to work: (setvar 'measurement 1) (command "._-SCALELISTEDIT" "_Reset" "_Yes" "_Exit")
  2. 2 points
    That is a myth, open up any book from any version and look at the list of commands in AutoCAD LT the very first entry is and has always been 3DPOLY What LT is missing are many of the 'tools' for working with 3D and LT cannot create 3D solids, meshes etc. but it can certainly open a drawing that contains them and it does have a whole load of tools for getting around and viewing 3D modelspace. We have 3D views, the 'hide' command to better visualize 3D models. Measurements are taken accurately from 3D points. In fact one question that comes up regularly in LT forums is how to get rid of 3D data and change it to 2D (unfortunately that is also a problem in LT with its limited set of tools and commands). But 3D space in LT is very real, and very useablein LT. The list of commands that work only in a 3D model within LT are not always in the Ribbon or Menu, but they are there eg hide, shademode, 3D views, vpoint, even the UCS command. And most commands will work within 3D space 'Align' prompts for 3 sets of points as source and destination and works perfectly fine for aligning 3D geometry. Many types of geometry have to be coplaner "flat" eg ployline, but there are no restrictions on the orientation of that plane in 3D space and by altering the UCS and the viewing angle you can draw a 3D box using the polyline command. Yes LT cannot create or edit 3D solids, but it is capable of so much more in a 3D modelspace, and LT is definately not ONLY 2D
  3. 2 points
    Just guessing check the dimension's Text Offset value in the Properties Palette If it's negative remove the minus sign.
  4. 2 points
    There have been a few times in the past where I had to work on someone else's drawing and they had overlapping viewports with the viewport frames turned off. Their drawing filled the entire space within the title block border, so I double clicked inside the border to get into model space but was unable to select anything inside the smaller viewports. Talk about frustrating. I finally figured out what they had done but it took me a minute to realize there were other viewports on top of the main viewport.
  5. 2 points
    The one situation that causes me worry about overlapping viewports is when neither has enough blank space to keep the model geometry from overlapping. I go to an extra page for that one. There's too much overhead in time needed to set up a screening mask or wipeout in modelspace on a special layer that only hides stuff in one viewport while being frozen in all the others. Then suppose somebody else has to edit that sucker, with a giant invisible background color wipeout or hatch hiding half the universe.
  6. 2 points
    Using that in the drawing I'm working on now. Never had an issue that way.
  7. 2 points
    I agree with Tombu about avoiding viewports on top of viewports. I don't know of any known issues caused by doing this, it's just my own personal preference. For something like this, I would create a polygonal viewport for my main view so I can create a space for my smaller viewport.
  8. 2 points
    It's really old now and probably needs to be updated:
  9. 2 points
    There's no such thing as an "angle guide" in AutoCAD. Do you mean your Polar Tracking was turned off?
  10. 2 points
    "AcDbMTEXT" must be "AcDbMText" Edit: all credits to @rlx for the good example he offered.
  11. 2 points
    @Grrr Give this a try: (defun c:test (/ d cvp vp enx ll ur) (cond ((and (setq vp (car (entsel "\nPick viewport: "))) (setq enx (entget vp))) ;; Force model space before setting cvport (vlax-put (setq d (vla-get-activedocument (vlax-get-acad-object))) 'mspace 1) (setvar 'cvport (cdr (assoc 69 enx))) (vla-getboundingbox (vlax-ename->vla-object (car (entsel "\nPick Object"))) 'll 'ur) (vla-zoomwindow (vlax-get-acad-object) ll ur) (vlax-put d 'mspace 0) ) ;; (setvar 'cvport cvp) ) ; if ) ; defun
  12. 2 points
    maybe try moving your 10 / 11 groups right after (cons 100 "AcDBMtext"). Often the order or dxf groups matters. just a random section from one of my app's (RlxMas to be exactly , posted here a couple of years ago) (setq elist (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 %pnt) (cons 1 msg) '(90 . 1) (cons 63 #bgc) (cons 40 (/ (getvar "VIEWSIZE") 30.0)) (cons 71 atc) '(72 . 5) '(441 . 0) )) (setq mobj (vlax-ename->vla-object (entmakex elist))) and thank you for adressing all who responded to your thread , not everybody is this polite anymore
  13. 2 points
    They'll have to pry my Dell U3818DW out of my cold dead hands! https://www.amazon.com/Dell-Screen-LED-Lit-Monitor-U3818DW/dp/B073FHWTPL
  14. 2 points
    When operating on objects nested within block definitions in addition to primary objects, it typically becomes easier to iterate over the ActiveX Block Collection, e.g.: (defun c:fixlay ( / doc lay lst ltp lyr ) (setq lst '( "DASHED" "CENTER" "PHANTOM" ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) lyr (vla-get-layers doc) ) (vlax-for blk (vla-get-blocks doc) (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (member (setq ltp (strcase (vla-get-linetype obj))) lst) (vlax-write-enabled-p obj) (or (member ltp lay) (and (vla-add lyr ltp) (setq lay (cons ltp lay)) ) ) ) (progn (vla-put-linetype obj "bylayer") (vla-put-linetypescale obj 0.2) (vla-put-layer obj ltp) ) ) ) ) ) (princ) ) (vl-load-com) (princ)
  15. 2 points
    Wetransfer is another. Downloaded like 250Mb file.
  16. 2 points
    Put your north arrows in model space then you don't have to worry about the angle.
  17. 2 points
    Here's a quick (untested) adaption of your code to integrate a call to my LM:listbox function: (defun c:formatxr ( / cmd def lst ) (while (setq def (tblnext "block" (not def))) (if (= 4 (logand 4 (cdr (assoc 70 def)))) (setq lst (cons (cdr (assoc 2 def)) lst)) ) ) (if lst (progn (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (foreach xrf (LM:listbox "Select Xrefs to Format" (acad_strlsort lst) 1) (command "_.-layer" "_color" 252 (strcat xrf "|*") "_pstyle" "Shade 50%" (strcat xrf "|*") "_color" 150 (strcat xrf "|C-PVMT-ASPH," xrf "|C-PVMT-CONC," xrf "|C-PVMT-GRVL") "_freeze" (strcat xrf "|X-TOPO-TEXT") "" ) ) (setvar 'cmdecho cmd) ) (princ "\nNo xrefs are defined in the active drawing.") ) (princ) )
  18. 2 points
    Try this you need to save the Multi Radio buttons.lsp to a support path for it to work can be used in any program will work with up to about 20 xref names. If you have more then 20 need to use a listbox library routine see Lee-mac.com. (defun choosexref ( / lst doc blocks n but) (vl-load-com) (setq lst '()) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq blocks (vla-get-Blocks doc)) (vlax-for n blocks (if (eq (vla-get-IsXref n) :vlax-true) (progn (setq xname (vl-string-translate (chr 92) (strcat (chr 92)(chr 92)) (vla-get-path n))) (setq lst (cons xname lst)) ) ) ) (setq lst (cons "Please choose xref" lst)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (= but nil)(setq but 1)) (setq xrsel (ah:butts but "V" lst)) (princ) ) Multi radio buttons.lsp
  19. 2 points
    This should give you the way to go with if your field structure is correct. https://www.cadtutor.net/forum/topic/72618-current-drawings-path-and-filename-in-autolisp/?tab=comments#comment-578985
  20. 2 points
    Hi @BIGAL Your Lisp working well. According @Ish requirement is here (defun c:dd (/ sss obj ang ss vpo) (command "._PSPACE") (prompt "\nSelect source Viewport") (setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport")) )) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (setq ang (vlax-get obj 'TwistAngle)) ) (prompt "\nSelect North symbol Vewport") (setq ss (ssget "_+.:E:S" (list (cons 0 "Viewport")))) (setq vpo (vlax-ename->vla-object (ssname ss 0))) (vlax-put-property vpo 'TwistAngle ang) ) Original Result TwistAngle on Viewport.lsp
  21. 2 points
    Here is a more than you asked for but shows the properties of a viewport you could pick north point and get angle, you may need to set angdir 1st else will possibly get wrong angle. You should be able to put twistangle not tested. (command "._PSPACE") (setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport")))) (setq cspace (cdr (assoc 69 (entget (ssname sss 0))))) (setq obj (vlax-ename->vla-object (ssname sss 0))) (if (= (vla-get-objectname obj) "AcDbViewport") (progn (setq cen (vlax-get obj 'Center )) (setq ht (vlax-get obj 'Height)) (setq wid (vlax-get obj 'Width)) (setq sc (vlax-get obj 'customscale )) (setq ang (vlax-get obj 'TwistAngle)) )) I have the other rotate block to match a viewpoint angle.
  22. 2 points
    I've used THIS site in the past to identify fonts .. the result does not have a perfect match from what I see though.
  23. 2 points
    My QuickField application is designed to generate fields which reference object properties, and so may only be used to generate field expressions found under the 'Object' category within the FIELD command dialog. As @tombu has helpfully suggested, field expressions with no dependence on Object IDs may be embedded directly within a template without losing the ability to update the field value.
  24. 2 points
    Field examples you can add to template title block since they reference the current document not drawing objects. Drawing path and filename with file extension: %<\AcVar Filename \f "%fn7">% Drawing path and filename without file extension: <\AcVar Filename \f "%fn3">% This way they will automatically update if you move or rename the drawing.
  25. 2 points
    @mark_kostic - you might also create a block that contains a FIELD that contains the drawing path and filename, then you can just insert this block each time, or include it in your templates.
  26. 2 points
    It will depend on the objects (and number of objects/size of drawing) but a simple method I often use is select everything and in properties turn transparency to 50 and lineweight to the highest setting, then turn lineweight visibility on. This does depend on whether you actually use those settings in your drawing. But if not it gives a quick visual clue as to where problem areas are. And as an added bonus you can also quicly see where lines are made up of short segments, because where objects touch or overlap you see a clear color difference. And when you are done simply turn transparency and lineweight back to 'ByLayer'. Sometimes it is also easier if you also use properties to overide the color when there are many colors in a drawing. This does depend on everything using properties 'ByLayer' otherwise you lose those individual settings.
  27. 2 points
    Its not like that. The codes that I posted allow the user to select as many as they want then you need after that to iterate the selection set and do your stuff at each entity object. e.g: (if (setq ss (ssget '((0 . "*POLYLINE") (8 . "DWG_SHEET") (-4 . "<AND") (-4 . "&=") (70 . 1) (-4 . "AND>")))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i)))) ;; one entity which is eaual to single selection like, (car (entsel "\nSelect object :")) ;; do your stuff here .... ) )
  28. 2 points
    This should work I believe. (defun c:Test ( / int sel ent get str pos) ;; Tharwat - Date: 26.Mar.2021 ;; (and (princ "\nSelect Mleader objects to parse strings after DASH once found : ") (setq int -1 sel (ssget "_:L" '((0 . "MULTILEADER")))) (while (setq int (1+ int) ent (ssname sel int)) (setq get (entget ent) str (assoc 304 get) ) (and (setq pos (vl-string-search "-" (cdr str))) (entmod (subst (cons 304 (substr (cdr str) (+ 2 pos))) str get)) ) ) ) (princ) ) (vl-load-com)
  29. 2 points
    Give this a shot and let me knw. (defun c:Test ( / i s e g p q l r m d) ;; Tharwat - Date: 25.Mar.2021 ;; (and (princ "\nSelect parallel line objects to replace with closed polylines : ") (setq i -1 s (ssget "_:L" '((0 . "LINE")))) (while (setq i (1+ i) e (ssname s i)) (setq g (entget e) p (cdr (assoc 10 g)) q (cdr (assoc 11 g)) l (cons (list (cdr (assoc -1 g)) (mapcar '(lambda (j k) (/ (+ j k) 2.)) p q) p q) l) ) ) (progn (foreach itm l (or (vl-position (car itm) d) (and (setq m (cadr itm)) (setq r (cadr (vl-sort l '(lambda (j k) (< (distance m (cadr j)) (distance m (cadr k))))))) (not (vl-position (car r) d)) (setq p (caddr itm)) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1)) (mapcar (function (lambda (n) (cons 10 n))) (append (list p) (vl-sort (cddr r) '(lambda (j k) (< (distance p j) (distance p k)))) (list (cadddr itm)) ) ) ) ) (setq d (cons (car itm) d) d (cons (car r) d) ) ) ) ) (mapcar 'entdel d) ) ) (princ) ) (vl-load-com)
  30. 2 points
    version 2 ; Join end of 2 multiple lines convert to pline ; By Alan H March 2021 (defun c:joinends ( / pt1 pt2 start end swapends) (defun ah:swapends (pt / temp d1 d2 ent) (setq ent (entget (ssname (ssget pt)0 ))) (setq lay (cdr (assoc 8 ent))) (setq end (cdr (assoc 11 ent))) (setq start (cdr (assoc 10 ent))) (setq d1 (distance pt end)) (setq d2 (distance pt start)) (if (< d1 d2) (progn (setq temp end) (setq end start) (setq start temp) ) ) (command "erase" (cdr (assoc -1 ent)) "") (princ) ) (setq oldsnap (getvar 'osmode)) (prompt "\nPick points eg left and right of lines") (setq pt1 (getpoint "\Pick 1st point ")) (setq pt2 (getpoint pt1 "\Pick 2nd point ")) (setq lst (list pt1 pt2)) (setq ss (ssget "F" lst (list (cons 0 "*line")))) (setq lay (cdr (assoc 8 (entget (ssname ss 0))))) (setq lst2 '()) (repeat (setq x (sslength ss)) (setq ent (ssname ss (setq x (- x 1)))) (setq obj (vlax-ename->vla-object ent)) (setq pt3 (vlax-curve-getclosestpointto obj pt1)) (setq dist (distance pt1 pt3)) (setq lst2 (cons (list dist pt3) lst2)) ) (setq lst2 (vl-sort lst2 '(lambda (x y) (< (car x)(car y))))) (setq lst '()) (setq x 0) (setvar 'osmode 0) (repeat (/ (sslength ss) 2) (setq lst '()) (setq pt3 (nth 1 (nth x lst2))) (ah:swapends pt3) (setq lst (cons (list (car start) (cadr start))lst)) (setq lst (cons (list (car end)(cadr end)) lst)) (setq pt4 (nth 1 (nth (+ x 1) lst2))) (ah:swapends pt4) (setq lst (cons (list (car end)(cadr end)) lst)) (setq lst (cons (list (car start) (cadr start))lst)) (setq x (+ x 2)) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 lay) (cons 90 (length lst)) (cons 70 1)) (mapcar (function (lambda (p) (cons 10 p))) lst) ) ) ) (setvar 'osmode oldsnap) (princ) )
  31. 2 points
    Your dialogue box is for lineweight, which is different to thickness and width. To see the lineweight you need to highlight the icon shown with the red arrow in this image, if you don't see the icon you can make it visible by clicking on the 3 horizontal lines (yellow arrow) and select line weight.
  32. 2 points
    that's a good suggestion Bigal , but if OP's company policy is anything like mine it's not only about location but also extension. My company uses 'block everything except...' where every $%^& single file has to be 'white listed' and even updates of a program can mess things up and complete app has to be white listed all over again. But hey , it might work... I'm in a constant state of cold war with my IT department , I think of something and when they find out they find a way to block it... if they really hate me all they have to do is switch to AutoCad LT (don't tell them that I said that!)
  33. 2 points
    OK. Attached is correct lisp. Entirely my fault. arec(1).lsp
  34. 1 point
    My first contact with AutoCad was R12 or 13. My boss used it for mechanical drawings. I think AutoCad is only limited to your imagination. I've tried solidworks before......I'm still an AutoCad fan. Not that I'm saying solidworks is bad just AutoCad is my choice. Buying LT (To me) would be like buying a Volkswagen beetle when you need a truck. But you also have to look at $1700+ per year vs. $440 per year. I'm not arguing for AutoCad over LT but the customer/user needs to look at exactly what it will be used for.
  35. 1 point
    I'd go KISS on this one and set up a template drawing with my "custom" scale list already in it. No lisp required.
  36. 1 point
    AutoCAD Electrical is part of the AutoCAD Toolset, so it comes free with AutoCAD.
  37. 1 point
    What's this "2" monitor set up you speak of? Dell U3818DW and Samsung P2770HD
  38. 1 point
    @Trudy read the instructions in the lsp file header. see the new attachment here. I've added an option to set the offset distance, but I cant set a default value... see if you can help... Contour_Label.lsp
  39. 1 point
    if you calculate 584 / 25.4 you get 22.9 so you probably have an issue with your insunits settings (25.4 beeing inches). I have created an app for my company called FX (fast xref) and by dialog you can select which plot plans to attach. All xrefs have same scale (1) and inspoint (0,0) so they all insert in the right place with the right size. Part of this routine sets a couple of variables to make sure all xrefs use the same units. I was away for a couple of years and when I returned I found most of my children , oh I mean xrefs , were abused horribly so that's why I created this. (setvar "insunits" 0) ;blocks insert in millimeters 4 , 0 = no units (setvar "INSUNITSDEFSOURCE" 0) ;blocks insert in millimeters (setvar "INSUNITSDEFTARGET" 0) ;blocks insert in millimeters (setvar "LAYEREVAL" 0) ;no layer nagging (setvar "LAYEREVALCTL" 0) ;no layer nagging (setvar "LAYERNOTIFY" 0) ;no layer nagging ;;; - dwgunits : 3=mm, 2=decimal, 4=precision, scale upon insert = no , match insunits = no! (command "-dwgunits" 3 2 4 "no" "no")(while (= 1 (logand (getvar "cmdactive") 1))(command "No")) not so long ago changed this routine so it no longer uses 'command' but I would have to fire up my other computer upstairs and right know my couch is just to comfortable. But this should work too...
  40. 1 point
    The issue is caused by the update to the CADTutor forum software removing all instances of "8 )" (without the space) from all code snippets, breaking them. In this case, change: (setq code (grread t ) To: (setq code (grread t 8))
  41. 1 point
    Down load Bricscad 30 day trial then that gives you 29 days to get lots of freebie lisps like Grids. Just make sure you describe as much as possible what you need, "I want Grids" will probably reveal like 50 different type of grid programs.
  42. 1 point
    Does it have to be an AutoDesk product? There are less expensive options such as BricsCAD, nanoCAD and Draftsight. Each of these is an AutoCAD clone capable of reading and writing to the .DWG format. Just asking.
  43. 1 point
    Have you thought about organizing your drawings differently? IMO, some of these problems could be avoided.
  44. 1 point
    This should be the missing part you need to finish the goal of your program and I am sure that you do the rest part for lines. ;; where variables: ;; ;; obj = Green Polyline. ;; ;; lst = list of intersected points. ;; ;; srt = sorted points to use to create lines in order. ;; (foreach pt lst (setq pts (cons (vlax-curve-getdistatpoint obj (vlax-curve-getclosestpointto obj pt)) pts)) ) (setq srt (vl-sort pts '(lambda (j k) (< j k))))
  45. 1 point
    No need to cycle through tabs to change object properties .. this one will exclude hatch. (defun c:foo (/ s) ;; RJP » 2021-03-31 ;; Change all color byblock objects to bylayer (if (setq s (ssget "_x" '((0 . "~HATCH") (62 . 0)))) (foreach e (mapcar 'cadr (ssnamex s)) (entmod (append (entget e) '((62 . 256))))) ) (princ) )
  46. 1 point
    You can do all this with the usual commands: _Model _Grid _Off -Purge _All _No _zoom _E _tilemode 0 _zoom _E Use this to process multiple drawings - AutoRunLisp commands.txt
  47. 1 point
    Here you go with UNTESTED function. Your attributed block must be regular and not dynamic in this case, and inserted only once into your drawing since the following function get the info from the firstly found block. Waiting for your kind reply. (defun TH:Attribute:value:to:custom:key ( att:blk:name tag:name custom:key / att sum int) ;; Tharwat - Date: 22.Mar.2021 ;; (and (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 att:blk:name) '(66 . 1) (cons 410 (getvar 'CTAB))))) (foreach obj (vlax-invoke (vlax-ename->vla-object (ssname sel 0)) 'Getattributes) (and (= (vla-get-tagstring obj) tag:name) (setq att (vla-get-textstring obj)) ) ) (setq sum (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object)))) (repeat (setq int (vla-numcustominfo sum)) (and (setq int (1- int)) (progn (vla-getcustombyindex sum int 'name 'value) (and name (= name custom:key)) ) (not (vl-catch-all-apply 'vla-removecustombykey (list sum name))) (vla-addcustominfo sum name att) ) ) ) (princ) ) (vl-load-com)
  48. 1 point
    Yeah worked straight away. _CG_FLAG (1).dwg
  49. 1 point
    And I'm over here still typing all my commands in.
  50. 1 point
    I would suggest that you stop using annotative scaling for your dimensions and text, take them out of model space and put them in your paper space layout. A lot less hassle and few if any system variables to deal with.
  • Newsletter

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