Jump to content

Leaderboard

  1. SLW210

    SLW210

    Moderator


    • Points

      5

    • Posts

      11,549


  2. BIGAL

    BIGAL

    Trusted Member


    • Points

      5

    • Posts

      20,022


  3. ReMark

    ReMark

    Trusted Member


    • Points

      4

    • Posts

      46,315


  4. nod684

    nod684

    Community Member


    • Points

      4

    • Posts

      411


Popular Content

Showing content with the highest reputation since 03/05/2026 in all areas

  1. I am not good as the others but try this. It will build what you want to achieve but not exactly as what was shown in the image. Maybe other can improve the code. (defun c:LayerLegend (/ doc lays lay laylist layname laycolor laydesc pt x y starty rowH txtH headH colHT col1 col2 col3 totalH legendBlock w) (defun GetTextWidth (txt height / doc ms txtObj minp maxp w) (if (or (not txt) (= txt "")) 0 (progn (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq ms (vla-get-ModelSpace doc)) ;; create temp text off-screen (setq txtObj (vla-AddText ms txt (vlax-3d-point -1000 -1000 0) height)) ;; initialize safearrays (setq minp (vlax-make-safearray vlax-vbDouble '(0 . 2))) (setq maxp (vlax-make-safearray vlax-vbDouble '(0 . 2))) ;; get bounding box safely (vl-catch-all-apply '(lambda () (vla-GetBoundingBox txtObj 'minp 'maxp) )) ;; width in X direction (setq w (abs (- (vlax-safearray-get-element maxp 0) (vlax-safearray-get-element minp 0)))) ;; delete temp text (vla-Delete txtObj) w ) ) ) (vl-load-com) (setq rowH 8.0) (setq txtH 2.0) (setq headH 2.5) (setq colHT 1.0) (setq col1 35.0) ;; fixed column 1 width (setq col2 50.0) ;; fixed column 2 width (setq col3 65.0) ;; fixed column 3 width (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq lays (vla-get-Layers doc)) (setq laylist '()) (vlax-for lay lays (setq layname (vla-get-name lay)) (setq laydesc (if (vlax-property-available-p lay 'Description) (vla-get-description lay) "")) ;; Skip 0, Defpoints, XREF (if (and (/= layname "0") (/= (strcase layname) "DEFPOINTS") (not (vl-string-search "|" layname))) (progn (setq laycolor (vla-get-color lay)) (setq laylist (cons (list layname laycolor laydesc) laylist)) ) ) ) (setq laylist (vl-sort laylist '(lambda (a b) (< (strcase (car a)) (strcase (car b)))) ) ) (if (setq legendBlock (tblsearch "BLOCK" "LAYERLEGEND_MARK")) (command "_.erase" "B" "LAYERLEGEND_MARK" "") ) (setq pt (getpoint "\nPick insertion point: ")) (setq x (car pt)) (setq y (cadr pt)) (setq starty y) (setq totalH (* rowH (+ (length laylist) 1))) (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list x starty 0)) (cons 11 (list (+ x col1 col2 col3) starty 0)))) (entmakex (list '(0 . "TEXT")(cons 8 "0") (cons 10 (list (+ x 3) (- y 5) 0)) (cons 40 headH) (cons 1 "COLOR NUMBER"))) (entmakex (list '(0 . "TEXT")(cons 8 "0") (cons 10 (list (+ x col1 3) (- y 5) 0)) (cons 40 headH) (cons 1 "LAYER NAME"))) (entmakex (list '(0 . "TEXT")(cons 8 "0") (cons 10 (list (+ x col1 col2 3) (- y 5) 0)) (cons 40 headH) (cons 1 "DESCRIPTION"))) ;; header bottom line (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list x (- y rowH) 0)) (cons 11 (list (+ x col1 col2 col3) (- y rowH) 0)))) (setq y (- y rowH)) (foreach L laylist (setq layname (nth 0 L)) (setq laycolor (nth 1 L)) (setq laydesc (nth 2 L)) ;; Color number text (1 mm) on its layer (entmakex (list '(0 . "TEXT") (cons 8 layname) (cons 10 (list (+ x 3) (+ y -2.2) 0)) (cons 40 colHT) (cons 1 (itoa laycolor)))) ;; Sample line on its layer (entmakex (list '(0 . "LINE") (cons 8 layname) (cons 10 (list (+ x 3) (- y 3) 0)) (cons 11 (list (+ x col1 -3) (- y 3) 0)))) ;; Layer name text on its layer (entmakex (list '(0 . "TEXT") (cons 8 layname) (cons 10 (list (+ x col1 3) (- y 4) 0)) (cons 40 txtH) (cons 1 layname))) ;; Description text (Layer 0) (entmakex (list '(0 . "TEXT") (cons 8 "0") (cons 10 (list (+ x col1 col2 3) (- y 4) 0)) (cons 40 txtH) (cons 1 laydesc))) ;; Row horizontal line (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list x (- y rowH) 0)) (cons 11 (list (+ x col1 col2 col3) (- y rowH) 0)))) (setq y (- y rowH)) ) (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list x starty 0)) (cons 11 (list x (- starty totalH) 0)))) (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list (+ x col1) starty 0)) (cons 11 (list (+ x col1) (- starty totalH) 0)))) (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list (+ x col1 col2) starty 0)) (cons 11 (list (+ x col1 col2) (- starty totalH) 0)))) (entmakex (list '(0 . "LINE")(cons 8 "0") (cons 10 (list (+ x col1 col2 col3) starty 0)) (cons 11 (list (+ x col1 col2 col3) (- starty totalH) 0)))) (princ) )
    2 points
  2. Nice program as always Tharwat. I think what the OP need is create a table as attached for visual reference.
    2 points
  3. I would ask that you delete your drawings. Why? Because another student could come along and borrow them, make minor changes then submit them as their own drawings thus saving hours of labor. You do all the work and they get the credit. Not kosher at all. Follow me? Addendum: Looks like someone has already done exactly that. Again, take your drawings down. There are plenty of image files (not CAD files for students) to reference. Thank you.
    2 points
  4. Here's my program : https://autolispprograms.wordpress.com/create-layers-from-excel-file/
    2 points
  5. Just my $0.05 there was another post about doing breaklines maybe at Forums/autodesk/lisp. One answer provided had multiple break styles that looked very useful. I will spend a couple of minutes and see if I can find the link.
    1 point
  6. If I understood the request correctly... This could be a design start, it uses the oblique block of the dimension. (vl-load-com) (defun circle2lw (e / dxf_ent pt_cen radius fst_pt opp_pt) (setq dxf_ent (entget e) pt_cen (cdr (assoc 10 dxf_ent)) radius (cdr (assoc 40 dxf_ent)) fst_pt (polar pt_cen 0.0 radius) opp_pt (polar pt_cen pi radius) ) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (assoc 67 dxf_ent) (assoc 410 dxf_ent) (assoc 8 dxf_ent) (if (assoc 6 dxf_ent) (assoc 6 dxf_ent) '(6 . "BYLAYER")) (if (assoc 62 dxf_ent) (assoc 62 dxf_ent) '(62 . 256)) (if (assoc 370 dxf_ent) (assoc 370 dxf_ent) '(370 . -3)) (if (assoc 48 dxf_ent) (assoc 48 dxf_ent) '(48 . 1.0)) '(100 . "AcDbPolyline") '(90 . 2) '(70 . 1) (cons 43 0.0) (cons 38 (caddr fst_pt)) (if (assoc 39 dxf_ent) (assoc 39 dxf_ent) '(39 . 0.0)) (cons 10 (list (car fst_pt) (cadr fst_pt))) '(40 . 0.0) '(41 . 0.0) '(42 . 1.0) (cons 10 (list (car opp_pt) (cadr opp_pt))) '(40 . 0.0) '(41 . 0.0) '(42 . 1.0) (assoc 210 dxf_ent) ) ) (entdel e) (entlast) ) (defun c:Mybreak ( / ent obj_brk pt_brk vlaobj pr deriv alpha) (setvar "DIMBLK" "oblique") (while (setq ent (entsel "\nBreak point: ")) (setq obj_brk (car ent)) (cond ((member (cdr (assoc 0 (entget obj_brk))) '("POLYLINE" "LWPOLYLINE" "LINE" "ARC" "CIRCLE" "ELLIPSE" "SPLINE" "XLINE" "RAY")) (setq pt_brk (cadr ent)) (if (eq (cdr (assoc 0 (entget obj_brk))) "CIRCLE") (setq obj_brk (circle2lw obj_brk))) (setq vlaobj (vlax-ename->vla-object obj_brk)) (initget 1) (setq pt_brk (vlax-curve-getClosestPointTo vlaobj (trans pt_brk 1 0) nil ) pr (vlax-curve-GetParamAtPoint vlaobj pt_brk) deriv (vlax-curve-getFirstDeriv vlaobj pr) alpha (atan (cadr deriv) (car deriv)) ) (command "_.break" obj_brk "_none" pt_brk "_none" pt_brk) (initget 1) (command "_.-insert" "_oblique" "_scale" (distance (trans pt_brk 0 1) (getpoint (trans pt_brk 0 1))) (trans pt_brk 0 1) (angtos alpha (getvar "AUNITS") 13)) ) (T (princ "\nThis object can't be break!")) ) ) (princ) )
    1 point
  7. You might try Lee Mac's Steal from Drawing | AutoCAD | Autodesk App Store. I just do a SAVE or SAVEAS on the drawing and make a new exact COPY of the drawing. If I have similar drawing that could use the other viewport and settings, I just drag the Layout from one drawing to the other with Design Center. There is an Export Layout to Model... when you right-click a Layout TAB and before that option was in AutoCAD there were some programs that would do that. To do what you want looks to be a lot of work for a LISP.
    1 point
  8. You need to use ERASE to remove items in order for OOPS to actually restore it.
    1 point
  9. Command CBL: puts the Breakline symbol 4.0 units from the start, the breakline symbol is 1.0 units wide, and the tip is 0.4 units up or down the line. Obviously feel free to change those values. command CBLU: Same, except the user must give all the values. ;; Custom Breakline ;; @params ;; ps: start point ;; pe: end point ;; gap: gap between the two halves of the lines ;; loc: location of the center of the gap ;; tip: vertical size of the tip of the breakline symbol (default there's is 70° angle, but we'll give tip size) (defun CustomBreakLine ( ps pe gap loc tip / angl dst pline pl pd pm pu pr ) (setq angl (angle ps pe)) ;; angle (setq dst (distance ps pe)) ;; distalce of the line (without the breakline symbol) (setq pm (polar ps angl loc)) ;; mid point of the gap (setq pl (polar ps angl (- loc (/ gap 2.0)))) ;; left point of the breakline symbol (setq pr (polar ps angl (+ loc (/ gap 2.0)))) ;; right point of the breakline symbol ;; down tip of the breakline symbol (setq pd1 (polar pl angl (/ gap 4.0))) (setq pd (polar pd1 (- angl (d2r 90.0) ) tip)) ;; up tip of the breakline symbol (setq pu1 (polar pm angl (/ gap 4.0))) (setq pu (polar pu1 (+ angl (d2r 90.0) ) tip)) (setq pl (drawLWPoly (list ps pl pd pu pr pe) 0)) ) ;; degree to rad (defun d2r (d / ) (/ (* pi d) 180.0) ) ;; Returns the middle of two points (defun mid-pt (p1 p2) (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.) ) ) ;; makes a polyline object with entmakex (defun drawLWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst))) ) ;;;;;;;;;;; ;; Custom BreakLine, User input values (defun c:cblu ( / ps pe gap loc tip ) (CustomBreakLine (setq ps (getpoint "\nStart pont: ")) (setq pe (getpoint ps "\nEnd pont: ")) (setq gap (getdist "\nGap distance: ")) (setq loc (getdist "\nLocation of the gap center (enter value, or select two points: start point + point of the gap): ")) (setq tip (getdist "\nTip height: ")) ) (princ) ) ;; Custom BreakLine, preset values (defun c:cbl ( / ps pe gap loc tip ) (CustomBreakLine (setq ps (getpoint "\nStart pont: ")) (setq pe (getpoint ps "\nEnd pont: ")) (setq gap 1.0) (setq loc 4.0) (setq tip 0.4) ) (princ) ) (princ "\nCommand CBL for Custom BreakLine: ") (princ) Happy with this?
    1 point
  10. That's because you need to do something before issuing the oops command. I think there is a thread here differentiating oops and undo command.
    1 point
  11. You created this thread before even trying it in your AutoCAD?
    1 point
  12. 1 point
  13. In this link, it's written that OOPS command exist : In AutoCAD since version ≤ R12...
    1 point
  14. Your points will fall on the grid lines not inside the boxes created by the grid lines.
    1 point
  15. Bit odd yes tested in Bricscad, I will look at the getcellextents, this gives the XY position of the corners of the table cell. If the line is 69 times repeated it sounds like that is the problem. I will make a little test program so can look at what is going on when calculating the Pt1 and Pt2. the code is done that way so if row height is changed for other users the lines are still central in the cell. Add the (princ line and look at the Y value displayed, it should change for every row. Please let me know if it is not changing. (setq pt2 (list (nth 6 pts)(nth 7 pts) 0.0)) (princ (strcat "\n" (rtos (cadr pt1) 2 3) " ")) (setq vdist (/ (- (cadr pt1) (cadr pt2)) 2.0)) Another test could some one try on Acad. 0 is 1st column. (setq objtable (vlax-ename->vla-object (car (entsel "\nPick a table ")))) ; put a number like 3+ in row variable ; then copy this line to command line change the 3 etc to 4 5 6 and so on ; The Y value should change (setq pts (vlax-safearray->list (vlax-variant-value (VLA-GETCELLEXTENTS objtable 3 0 :vlax-false))))
    1 point
  16. Works with BricsCAD. I know you have to wrap points in AutoCAD sometimes with (vlax-3d-point pt2) not sure about entmake tho.
    1 point
  17. In other words, you are having trouble understanding the concept of interpolation, correct? The mathematical interpolation of contours goes like this. Let's say we have two spot elevations A & B. A = 32.7 and B = 54.0. The distance between A & B = 50 feet. We want to know where our 40-foot contour would fall between spot elevations A & B. First obtain the total elevation difference. This is done by subtracting A from B. 54.0 minus 32.7 = 21.3. Next, we want the difference in elevation between our 40-contour interval and the nearest spot elevation which in this case is A or 32.7. That works out to be 7.3. Now we need to calculate the distance (let's call this "d") we need to go from spot elevation A to our 40-foot contour. That takes the form of: d/7.3=50/21.3 or d=7.3*50/21.3 = 7.3*2.347 = 17.13 or the distance, in decimal feet, to our 40-foot contour. Got all that? Good. Now go start interpolating.
    1 point
  18. Almost there its a table fixed a couple of bugs and done. Tested on a dwg with 500 layers a little slow takes a few seconds. ; https://www.cadtutor.net/forum/topic/99017-layer-table-lines-and-text/ ; Make a lgend of layers in dwg. ; Bt AlanH March 2026 (defun c:mktablay ( / colwidth doc lay lcol ldesc lname lst numrows objtable oldsnap pt pt1 pt2 rowheight) (defun CreateTableStyle ( / dicts dictobj key class custobj dwglays ) (setq dicts (vla-get-Dictionaries (vla-get-ActiveDocument(vlax-get-acad-object)))) (setq dictObj (vla-Item dicts "acad_tablestyle")) (vlax-for dname dictobj (if (= (vla-get-name dname) "DWGLAYERS" ) ; does it exist (princ "Found DWGLAYERS") (setq dwglays "No") ) ) (if (= dwglays "No") (progn (setq key "DWGLAYERS" class "AcDbTableStyle") (setq custObj (vla-AddObject dictObj key class)) (vla-put-Name custObj "DWGLAYERS") (vla-put-Description custObj "Dwg Index custom table style") (vla-put-BitFlags custObj 1) (vla-put-FlowDirection custObj acTableTopToBottom) (vla-put-HorzCellMargin custObj txtht ) (vla-put-VertCellMargin custObj txtht ) (vla-SetAlignment custObj (+ acDataRow acHeaderRow acTitleRow) acMiddleCenter) (vla-SetTextHeight custObj acDataRow txtht) (vla-SetTextHeight custObj acHeaderRow (* txtht 1.2)) (vla-SetTextHeight custObj acTitleRow (* txtht 1.5)) (vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "Standard") ) ) (princ) ) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setq txtht 1.5) (CreateTableStyle) (setvar 'ctablestyle "DWGLAYERS") (setq lays (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) (setq lst '()) (vlax-for lay lays (setq lname (vlax-get lay 'name)) (setq lcol (vlax-get lay 'color)) (setq ldesc (vlax-get lay 'description)) (setq lst (cons (list lcol lname ldesc) lst)) ) (setq lst (vl-sort lst '(lambda (x y) (< (cadr x)(cadr y))))) (setq pt (vlax-3d-point (getpoint "\npick a point for table "))) (setq doc (vla-get-activedocument (vlax-get-acad-object) )) (if (= (vla-get-activespace doc) 0) (setq curspc (vla-get-paperspace doc)) (setq curspc (vla-get-modelspace doc)) ) (setq numrows 3) (setq numcolumns 3) (setq rowht 5) (setq colwidth 50) (setq objtable (vla-addtable curspc pt numrows numcolumns rowht colwidth)) (vla-settext objtable 0 0 "Layer Details") (vla-settext objtable 1 0 "Color Numb. & Linetype") (vla-settext objtable 1 1 "Layer Name") (vla-settext objtable 1 2 "Layer description") (setq objtable (vlax-ename->vla-object (entlast))) (setq rowht (vla-getrowheight objtable 1)) (vla-put-regeneratetablesuppressed objtable :vlax-true) (setq row 2) (foreach lay lst (princ (cadr lay)) (vla-settext objtable row 0 (strcat (rtos (car lay) 2 0) " ")) (vla-setcellalignment objtable row 0 acMiddleRight) (vla-settext objtable row 1 (cadr lay)) (if (= (caddr lay) "") (setq desc (cadr lay)) (setq desc (caddr lay)) ) (vla-settext objtable row 2 desc) (setq pts (vlax-safearray->list (vlax-variant-value (VLA-GETCELLEXTENTS objtable row 0 :vlax-false)))) (setq pt1 (list (nth 0 pts)(nth 1 pts) 0.0)) (setq pt2 (list (nth 6 pts)(nth 7 pts) 0.0)) (setq vdist (/ (- (cadr pt1) (cadr pt2)) 2.0)) (setq pt1 (mapcar '+ pt1 (list 5.0 (- vdist) 0.0))) (setq pt2 (list (nth 3 pts)(nth 4 pts) 0.0)) (setq pt2 (mapcar '+ pt2 (list (- 7.0) (- vdist) 0.0))) (entmake (list (cons 0 "LINE") (cons 10 pt1) (cons 11 pt2) (cons 8 (cadr lay)))) (vla-insertrows objtable (setq row (1+ row)) rowht 1) ) (vla-put-regeneratetablesuppressed objtable :vlax-false) (setvar 'osmode oldsnap) (princ) ) (c:mktablay)
    1 point
  19. Thanks!! it's working fine. It's okay if it's not exactly the same from mine but as long as it can generate the table it's fine. saved me a lot of time.
    1 point
  20. Thank you I can use this as well...
    1 point
  21. yah it is... I overlooked it. All good now.
    1 point
  22. 1 point
  23. The OP seems to have exited the conversation, but just for others with the same inquiry. As I have mentioned, this is mostly an issue with your PDF editor, the instructions for using the OCR should be in Foxit Help. If this is something you need to do going forward without any effort, you need to use TTF.
    1 point
  24. As most of us use Microsoft Office products I switched from using AutoCAD's Swiss Lt BT TrueType font to ArialNarrow.ttf like SLW210 suggested as it's horizontally compressed to take up less space while being even more easily readable. While hindsight doesn't fix your immediate problem finding a font that doesn't cause issues with your PDF software before you need to output one to PDF again would solve your issues in the future. I've struggled with the same issue even with the full paid version of Adobe with drawings by others usually because of SHX text with various width factors. Never do that with a DWG you want to output to PDF unless you don't want anyone to convert that text back again.
    1 point
  25. In PDF-XChange Editor, I could only edit the Title Border Text. All the node text isn't editable. Using OCR in PDF-XChange, it converted all 5 pages in about 15 seconds. I am using the paid-for version, so not sure if OCR is available in the free version.
    1 point
  26. I opened your PDF in Acrobat Pro and the text was editable. This seems to be a Foxit issue, though as mentioned, you might want to use a TTF font if that's what Foxit needs. ArialNarrow.ttf is a common replacement IIRC to ISOCP.shx
    1 point
  27. Just do a google you should be able to find a ISO.TTF font there are thousands of fonts out there. You open c:\Windows\fonts and drag the TTF onto it from memory. ISO3098B ? If your lucky some one may have one already.
    1 point
  28. I can do that most of the time with the OCR (Optical character recognition) in Adobe Acrobat Pro. I thought Foxit has an OCR.
    1 point
  29. You may not have a choice here, but can you convert your text to TTF from SHX? PDF should accept that as text.
    1 point
  30. Not sure if this will work the way you want. I created a dummy drawing with a dummy block and a dummy attribute. When you set the attribute to Invisible, you can't see it any more, but you can edit it. I know, that's not what you want. I include it so you don't waste time trying it for yourself. When you set the attribute to Constant, you can't edit it at all. It no longer shows up in the Properties, and it doesn't show up in the block. If you change the attribute back to not constant, you can insert a new block and give it a different value, but it's still invisible and it does show up in Properties. Could be a bug? Or the way I handled it.
    1 point
×
×
  • Create New...