Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/16/2022 in all areas

  1. Hazzah, I commented out a (progn) while debugging and that threw the whole thing off. I'm good now lol
    1 point
  2. BricsCAD doesn't need the (function in front of lambda to run so i took it out. updated code.
    1 point
  3. Make sure your picking a folder you have read/write permission. my work pc i can't create a file on C:\ but i can in documents
    1 point
  4. First make the red circle and hatch into a block with the insertion point in the center. This will ask you to Select a Block. Next Select entities: this can be one or multiple polylines you wish to place the selected block around. ;;----------------------------------------------------------------------;; ;; COPY B TO EACH VERTICY OF POLYLINE (defun C:FOO (/ blk SS e ent coords) (setvar 'cmdecho 0) (setq blkname (cdr (assoc 2 (entget (car (entsel "\nSelect Block")))))) (prompt "\nSelect Polyline") (if (setq SS (ssget ":L" '((0 . "*POLYLINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq coords (vl-remove-if 'not (mapcar (function (lambda (p) (if (= 10 (car p)) (cdr p)))) (entget ent)))) (foreach pt coords (vl-cmdf "_insert" blkname "_non" pt "" "" "") ) ) ) (setvar 'cmdecho 1) (princ) )
    1 point
  5. I have no idea what is in your macro but have you thought about putting that code into Autocad so it does the same thing as the macro ? The other way is have your excel macro talk to Autocad its the same method open a Application. Attached is an example macro of Excel making objects in Autocad. (defun closeexcel ( / ) (if (= ah:ex "T") (vlax-invoke-method (vlax-get-property myxl "ActiveWorkbook") 'Close :vlax-False) (vlax-invoke-method (vlax-get-property myxl "ActiveWorkbook") "SaveAs" filename -4143 "" "" :vlax-false :vlax-false nil ) ) excel vba draw acad.txt
    1 point
  6. AutoCAD Help → AutoCAD User's Guide → Create Notes, Labels, and Leaders → Add Notes as Single-Line and Multiline Text → About Multiline Text Format https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-E4DC3A14-3F0A-46AE-9503-6BBEE8DAF916 → Tabs and Indents Works even easier than Word to me. Just select the portion of mtext you want to apply paragraph formatting to first. Needed for many notes in our drawings.
    1 point
  7. I avoided trying to learn how to do paragraph indenting in mtext its just not clear how to do once we had our std notes set up did not need to do again as could add and subtract but we did not do 1 a b c etc I think its in here pick the pi symbol change the first line maybe after highliting"a paragraph" I got something close by setting first line to 20 and hanging to 40. But really no idea what I was doing for consistency.
    1 point
  8. BIGAL, That's definitely one way of doing it. Trouble is to make this usable by all I need to keep it inside of AutoCAD. What I find is that if I add a tab on that line it changes "A" to "A.A". I believe there is a way to do this, I'll just have to hack around with it some more.
    1 point
  9. I cheated copied and pasted to word added the a sub item then made a new Mtext and copy pasted from Word. Should have spent some more time formatting paragraphs.
    1 point
  10. Is one of the lines something other than a plain polyline. I have sometimes frustrated myself trying to join two polylines only to find out one of them might be a polygon of some sort, like a rectangle 3" long and 0" wide. It looks like a polyline, properties says it is a polyline but it was drawn as a rectangle. I have not found a way to identify these little faux pas other than finally remembering that when I drew it, the command abruptly ended on the second point rather than offering to continue as it should have. I apparently had clicked the rectangle tool button instead of the polyline tool button. They are close together after all. Part of the program apparently remembers the object is a rectangle and refuses to join to it. Here's where somebody tells me to type the short cut because it is faster. That is fine if you don't have arthritis making your left hand only useful to lift a beer mug.
    1 point
  11. (vl-load-com) (defun c:study ( / ) (princ "\n Select a sample objects. There must be only 1 MTEXT.") (setq ss (ssget ":L")) (setq ssl (sslength ss)) (setq index 0) (setq sublist '()) (repeat ssl (setq ename (ssname ss index)) (setq obj (vlax-ename->vla-object ename)) (setq type (vlax-get-property obj 'EntityName)) (cond ((= type "AcDbMText") (setq textcontents (vlax-get-property obj 'TextString)) (setq textrotation (vlax-get-property obj 'Rotation)) (setq textinsertionpoint (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'InsertionPoint)))) (setq baselist (list type textcontents textrotation textinsertionpoint)) ) ((= type "AcDbBlockReference") (setq blockname (vlax-get-property obj 'Name)) (setq blockrotation (vlax-get-property obj 'Rotation)) (setq blockinsertionpoint (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'InsertionPoint)))) (setq subsublist (list type blockname blockrotation blockinsertionpoint)) (setq sublist (cons subsublist sublist)) ) ((= type "AcDbLine") (setq linestartpoint (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'StartPoint)))) (setq lineendpoint (vlax-safearray->list (vlax-variant-value (vlax-get-property obj 'EndPoint)))) (setq subsublist (list type linestartpoint lineendpoint)) (setq sublist (cons subsublist sublist)) ) ) (setq index (+ index 1)) );end of repeat (princ "\n base Mtext - ") (princ baselist) (princ "\n sub objects - ") (princ sublist) ; calculate delta (setq baserotation (caddr baselist)) (setq basepoint (cadddr baselist)) (setq sublistlen (length sublist)) (setq index2 0) (setq deltalist '()) (repeat sublistlen (setq subitem (nth index2 sublist)) (setq subtype (car subitem)) (cond ((= subtype "AcDbBlockReference") (setq subangle (angle basepoint (cadddr subitem))) (setq sublength (distance basepoint (cadddr subitem))) (setq anglediffer (- baserotation (caddr subitem))) (setq subsubsublist (list subtype (cadr subitem) anglediffer subangle sublength)) (setq deltalist (cons subsubsublist deltalist)) ) ((= subtype "AcDbLine") (setq subangle1 (angle basepoint (cadr subitem))) (setq sublength1 (distance basepoint (cadr subitem))) (setq subangle2 (angle basepoint (caddr subitem))) (setq sublength2 (distance basepoint (caddr subitem))) (princ basepoint) (princ (cadr subitem)) (setq subsubsublist (list subtype subangle1 sublength1 subangle2 sublength2)) (setq deltalist (cons subsubsublist deltalist)) ) );end of cond (setq index2 (+ index2 1)) );end of repeat (princ "\n delta objects - ") (princ deltalist) (princ "\n Set Find Range.") (setq ss2 (ssget ":L")) (setq ss2l (sslength ss2)) (setq index3 0) (setq mtextlist '()) (setq sublist2 '()) (repeat ss2l (setq ename2 (ssname ss2 index3)) (setq obj2 (vlax-ename->vla-object ename2)) (setq type2 (vlax-get-property obj2 'EntityName)) (cond ((= type2 "AcDbMText") (setq textcontents2 (vlax-get-property obj2 'TextString)) (if (= textcontents2 (cadr baselist)) (progn (setq textrotation2 (vlax-get-property obj2 'Rotation)) (setq textinsertionpoint2 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj2 'InsertionPoint)))) (setq baselist2 (list obj2 textrotation2 textinsertionpoint2)) (setq mtextlist (cons baselist2 mtextlist)) ) ) ) ((= type2 "AcDbBlockReference") (setq blockname2 (vlax-get-property obj2 'Name)) (setq blockrotation2 (vlax-get-property obj2 'Rotation)) (setq blockinsertionpoint2 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj2 'InsertionPoint)))) (setq subsublist2 (list type2 obj2 blockname2 blockrotation2 blockinsertionpoint2)) (setq sublist2 (cons subsublist2 sublist2)) ) ((= type2 "AcDbLine") (setq linestartpoint2 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj2 'StartPoint)))) (setq lineendpoint2 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj2 'EndPoint)))) (setq subsublist2 (list type2 obj2 linestartpoint2 lineendpoint2)) (setq sublist2 (cons subsublist2 sublist2)) ) ) (setq index3 (+ index3 1)) );end of repeat (princ "\n finded mtext list - ") (princ mtextlist) (princ "\n lego box - ") (princ sublist2) (setq mtextlistlen (length mtextlist)) (setq index4 0) (setq sublist2len (length sublist2)) (setq deltalistlen (length deltalist)) ;| (repeat mtextlistlen (setq ss3 (ssadd)) (setq mtextselected (nth index4 mtextlist)) (setq mtextselectedrotation (cadr mtextselected)) (setq mtextselectedpoint (caddr mtextselected)) (setq index5 0) (repeat sublist2len (setq sublist2selected (nth index5 sublist2)) (setq type3 (car sublist2selected)) (cond ((= type3 "AcDbBlockReference") (setq index6 0) (repeat deltalistlen (setq deltaatom (nth index6 deltalist)) (setq deltatype (car deltaatom)) (if (= deltatype type3) (if (= (caddr deltalist) (- mtextselectedrotation (cadddr sublist2selected))) (if (= |; (princ) );end of defun This is just a direction not answer. currently, it simply prints a list. I stopped because I have no time. i think it would be faster to just manually make 1000 blocks than to make this by my low level of lisping. haha for someone who want to do this, so I writing down the thinking If there is one mtext that is the standard for all groups Recognize a group as a list like a sample group. Make the list by (text string, rotation, and position) of the base mtext, List the rest of the objects (blocks, lines). In case of block (block name, insertion point, rotation) For lines (start point, end point) Then, compare the base mtext list with this list to create a list of difference values. The distance from the insertion point of the mtext, the angle, and the difference between the rotation angle of the mtext and the rotation angle of each object should be entered in this list. The vla-object id is also included in the list to make it easier to choose the right one later. Then create a new selection set to put the search range in. Or select entire drawing with x After that, a new list is created by selecting the standard mtext from the selection set. Since this list will be compared to the base list, it should contain the textstring, angle and insertion point of the mtexts. And make a lego box that is not organized with blocks and lines except for the rest of the mtext. Then, calculate the angle difference between the angles of the mtexts that satisfy the conditions and the angles of the base mtext, and use polar to find the appropriate ones in the lego box with the angle and length values in the delta list and put them in the new selection set. The problem here is that only the first value must be obtained after the condition is satisfied in case the components overlap in the exact same position. And you have to think about the case where only some of the components are satisfied. After that, each object is made into a block, and the existing individual objects are deleted and replaced with a block. It's easier than this to list or create statistics using blocks. This is how you can make a machine understand "looks like a block to a human". This is just my novice thinking. Maybe someone else with a good idea can solve it with one line of code.
    1 point
×
×
  • Create New...