Jump to content

Leaderboard

  1. Jonathan Handojo

    Jonathan Handojo

    Community Members


    • Points

      16

    • Content Count

      423


  2. Kalsefar

    Kalsefar

    Members


    • Points

      14

    • Content Count

      33


  3. BIGAL

    BIGAL

    Trusted Members


    • Points

      12

    • Content Count

      13,821


  4. eldon

    eldon

    Trusted Members


    • Points

      11

    • Content Count

      3,997



Popular Content

Showing content with the highest reputation since 11/01/2020 in all areas

  1. 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
  2. 2 points
    I was about to bring this challenge up So, this is a way to multiply large positive numbers: (defun multip (a b / q m n r c l) (setq q (max (length a) (length b))) (repeat (- q (length a)) (setq a (cons 0 a)) ) (repeat (- q (length b)) (setq b (cons 0 b)) ) (setq c 0) (repeat q (setq q (1- q) m (cons (nth q a) m) n (cons (nth q b) n) r (+ c (apply '+ (mapcar '* m (reverse n)))) c (/ r 10) l (cons (rem r 10) l) ) ) (setq n (reverse n) m (reverse m) ) (while (setq m (cdr m)) (setq n (cdr n) r (+ c (apply '+ (mapcar '* m (reverse n)))) c (/ r 10) l (cons (rem r 10) l) ) ) (while (> c 0) (setq l (cons (rem c 10) l) c (/ c 10) ) ) (while (zerop (car l)) (setq l (cdr l))) l ) _$ (MULTIP '(4 1 2 8 6 6 3 0 7) '(2 4 9 5 1 3 6 1 6)) (1 0 3 0 1 5 7 6 5 1 8 4 1 3 6 1 1 2) _$ (MULTIP '(4 1 2 8 6 6 3 0 7 4 1 2 8 6 6 3 0 7 4 1 2 8 6 6 3 0 7) '(2 4 9 5 1 3 6 1 6 2 4 9 5 1 3 6 1 6 2 4 9 5 1 3 6 1 6)) (1 0 3 0 1 5 7 6 5 3 9 0 1 6 7 6 4 2 6 7 7 3 1 9 5 1 9 7 5 8 4 3 9 8 6 6 4 7 1 2 8 7 9 8 9 1 8 4 1 3 6 1 1 2) _$ More efficient would be to divide the original number in fractions of thousand. The lisp above will work if 10 is replaced by 1000. But I'm more interested of some clever codes. Mine is (almost) just a translation of the way the kids are doing multiplication in class. ... and the test function (defun test (a b / l1 l2) (if (and (eq (type a) 'int) (eq (type b) 'int) ) (progn (while (> a 0) (setq l1 (cons (rem a 10) l1) a (/ a 10) ) ) (while (> b 0) (setq l2 (cons (rem b 10) l2) b (/ b 10) ) ) ;;; (alert (apply 'strcat (mapcar 'itoa (multip l1 l2))) ;;; ) ) ) ) _$ (test 412866307 249513616) "103015765184136112" _$
  3. 2 points
    Here you are nearly 2000 to choose from. You will have to find the free ones and then in a format you can use. Yeggi is a collection of 3D models from all over the web
  4. 2 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.
  5. 2 points
    Please provide a link to these invaluable 'defuns'. Not sure what 'Makes it easy to remember what to do' means? I'm sorry If I'm coming off brash but this post confuses the hell out of me.
  6. 2 points
    You haven't lived until you have had to learn formulas to convert binary, and base 16 (hexadecimal), to base 10 (decimal) numbers. You may be retrieving the wrong data item. Then again, my wireless router and a few other items have a straight up hexadecimal serial number.
  7. 2 points
    It's Hexidecimal, a base 16 computer numbering system used internally by the software after it's compiled. You can convert it using a number conversion website. The hex(idecimal) digits are 0 1 2 3 4 5 6 7 8 9 A B C D E F.
  8. 2 points
    Hi, The program was recreating the points due to the active list of entities along with the entdel function. Its not a good practice to feed While function with T and force to end stop the program with ESC button so try the following instead. (defun c:3pC2 (/ ss i sn ers lst) ;;; Tharwat 19. Nov. 2020 ;;; (while (and (princ "\nSelect THREE points to create a circle between them : ") (setq ers nil ss (ssget '((0 . "POINT")))) ) (if (eq (setq i (sslength ss)) 3) (progn (repeat i (setq sn (ssname ss (setq i (1- i)))) (setq ers (cons sn ers)) (setq lst (cons (cdr (assoc 10 (entget sn))) lst)) ) (command "_.circle" "_3P" "_none" (nth 0 lst) "_none" (nth 1 lst) "_none" (nth 2 lst) ) (foreach x ers (entdel x)) ) (alert "Error ... Please select 3 points only") ) ) (princ) )
  9. 2 points
    Like this? (defun c:effh (/ a c d) ;; RJP » 2020-11-16 (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)))) ) (vlax-for b (vla-get-blocks d) ;; This line will only process block definitions (if (= 0 (vlax-get b 'isxref) (vlax-get b 'islayout)) (vlax-for o b (cond ((and (vlax-write-enabled-p o) (wcmatch (vla-get-objectname o) "AcDbHatch")) (setq c (vla-get-backgroundcolor o)) (vla-setrgb c 0 0 0) (vla-put-backgroundcolor o c) ) ) ) ) ) (foreach l a (vlax-put l 'lock -1)) (vla-regen d acallviewports) (princ) )
  10. 2 points
    This should work unless you have the insert point of your attributed blocks far from the attribute definition. (defun c:test (/ int sel 1pt 2pt alg ent ins cls) (and (princ "\nSelect Attributed blocks to align to line : ") (setq int -1 sel (ssget "_:L" '((0 . "INSERT") (66 . 1))) ) (setq 1pt (getpoint "\nSpecify base point of line : ")) (setq 2pt (getpoint "\nSpecify next point of line : " 1pt)) (setq alg (entmakex (list '(0 . "LINE") (cons 10 1pt) (cons 11 2pt))) ) (while (setq int (1+ int) ent (ssname sel int) ) (and (setq ins (cdr (assoc 10 (entget ent))) cls (vlax-curve-getclosestpointto alg ins) ) (vlax-invoke (vlax-ename->vla-object ent) 'Move ins cls) ) ) ) (and alg (entdel alg)) (princ) ) (vl-load-com)
  11. 2 points
    Good catch pkenewell , probably simpler to implement too. Done something simular in the past.... wow , 2015, has it been five years ago already... how time flies... don't even know how this program works anymore haha
  12. 2 points
    How about: (defun foo ( l / a b ) (setq a (bar l) b (bar (mapcar '(lambda ( x ) (vl-list->string (reverse (vl-string->list x)))) l)) ) (list (substr (car l) 1 a) (mapcar '(lambda ( x ) (substr x (1+ a) (- (strlen x) a b))) l) (substr (car l) (- (strlen (car l)) b -1)) ) ) (defun bar ( l ) (apply 'min (mapcar '(lambda ( s ) (vl-string-mismatch (car l) s)) (cdr l))) ) _$ (foo '("Level 1 Floor Plan" "Level 2 Floor Plan" "Level 2b Floor Plan" "Level 3 Floor Plan")) ("Level " ("1" "2" "2b" "3") " Floor Plan") If you want case-insensitivity, simply include the ignore-case argument for the vl-string-mismatch function.
  13. 2 points
    I changed the thread title and added code tags. Please use relevant thread titles.
  14. 2 points
    Not to cut topic but: I just find: https://areatester.com/ looks nice. Free.
  15. 2 points
    I know I have an elderly version of AutoCAD, but these instances are a challenge to me. After converting to my version, the speed improved immensely when I set SHADEMODE to 2D.
  16. 1 point
    $ (rtos (* 412866307.0 249513616.0) 2) "1.0302E+17" _$ (rtos (* (float 412866307) (float 249513616)) 2) "1.0302E+17" _$
  17. 1 point
    Glad BlackBox's lisp worked for you! The prompts for the DVIEW command changed slightly a few versions back, in my first post an additional macro I believe should work for older versions but I have no way to test it as all I use now is 2021 versions. While coding in lisp as BlackBox did requires a learning curve the code rarely needs updating . Creating macro's is simple as noting how you achieve something using a command. Start with the command followed by a semicolon for enter. Each time user input is required add a \ each time you need to add a response like Yes or TWist add it and every time you need to hit enter while executing that command add another semicolon. About Special Control Characters in Command Macros
  18. 1 point
    Type chx as name implies "change in X direction" it would ask for a distance then pick objects, -ve is ok its old code 1990 needs to be redone made a bit smarter that is why I did not post its loaded on startup. It does not do multiple selections rather pick pick. (defun C:CHX ( / oldsnap k x newx) (SETVAR "CMDECHO" 0) (setq oldsnap (getvar "osmode")) (setvar 'osmode 512) (princ "\nMoves object in X direction") (setq x (getstring "\n What is amount of change: ")) (setq newx (strcat x ",0")) (while (setq newobj (entsel "\nPoint to object: Enter to exit ")) (command "move" newobj "" "0,0" newx) ) (setvar 'osmode oldsnap) (princ) )
  19. 1 point
    Lol, I just love how no one is actually offering any help despite this being a ridiculously easy task, haha... Friend... "Good people always think twice before helping". There's a reason no one is helping you. As much as I'm being an annoying pest, this is all you're getting from me. The rest is on your own. (defun c:arcdetails ( / arc) (and (setq arc (car (entsel "\nSelect arc <exit>: "))) ((lambda (x / ep sp) (princ (strcat "\nArc Start Point: " (vl-prin1-to-string (setq sp (vlax-get x 'StartPoint))) "\nArc Mid Point: " (vl-prin1-to-string (vlax-curve-getPointAtParam x (* 0.5 (vlax-curve-getEndParam x)))) "\nArc End Point: " (vl-prin1-to-string (setq ep (vlax-get x 'EndPoint))) "\nArc Radius: " (rtos (vla-get-Radius x) 2) "\nArc Length: " (rtos (vla-get-ArcLength x) 2) "\nChord Length: " (rtos (distance sp ep) 2) ) ) ) (vlax-ename->vla-object arc) ) ) (princ) )
  20. 1 point
    Try changing the start of the lisp to : (defun c:foo (/ d i g s) (vl-load-com) ;; RJP >> 2018-12-13
  21. 1 point
    Why don't you post your code?
  22. 1 point
    Probably “194395475601” is a 'real' serial. It does not follow the rules that seem to apply to the 'returned' number in your OP. For one thing the number of characters is uneven. But why do you ask? You must know how you have retrieved the number. But “194395475601” can also be a hex number.
  23. 1 point
    Not having had much practice with circles in hatch patterns, I thought I would try to use a 32 sided polygon (a triacontadigon) in the hatch pattern and see how much accuracy I could get. This makes a difference when the hatch is a long way from 0,0. Examining the format of the hatch pattern definition, there are angles, coordinates and distances. When one moves far from 0,0 accuracy of the angles is important because the effect is magnified and so are the distances. The coordinate is only the start point of the hatch pattern and thus can be less accurately defined (3 decimal places). One needs to aim for 10 decimal places for angles and distances, but also bearing in mind that the maximum length of a single line of definition is 80 characters. Because AutoCAD can only display angles to 8 decimal places, I thought to improve that accuracy by trigonometry. When one tweaks the direction of each side of the polygon to aim at the next pattern shape, the tangent of angles can always be defined by integer values. So too the distances. Thus with a spread sheet, one can calculate angles and distances more accurately then AutoCAD can display them. I managed to rewrite the Tactile Paving hatch pattern with a 32 sided circle with as many decimal places that I could and called it TactilePaving32.pat. As this was a bit of a trial for me, I will not be posting the actual definition file unless someone can't live without it! The picture below shows some hatches a long way from the origin (coordinates shown) of the two hatch patterns - TactilePaving and TectilePaving32. One can see how less accurate my first hatch pattern was (bits of line spread out all over the place), but as long as it is used close to the origin, it should suffice. But the latest file TactilePaving32 shows almost no separation of the hatch elements.
  24. 1 point
    Do you mean the menu bar? To turn menu bar on you can click that little arrow pointing downwards at the top of your screen (to the left of where it sais "Autodesk AutoCAD 2020") then show menu bar. The default for dimensions is in the annotate palette group. Personally, I like to use the menu bar for dimensions because it seems easier to select exactly what I want. But just me. I use "drafting and annotation' workspace (customized for me) with the menu bar on. You can change the workspace setting by clicking the gear at bottom right. Once you get everything set up the way you want you can click the gear again and save your workspace settings. If you still have access to your old computer one option is to go into tools, options, profiles tab, export. You can then place the file on your company server or email it to yourself. Then import your profile in Autocad on your new machine. It usually works fine but have seen some mixed results across different versions of Autocad. I really liked the old classic setup but they got rid of that back in like 2016 or something. (TEAR) -ChriS
  25. 1 point
    Perhaps something like this? (defun reginter-p ( rg1 rg2 / rtn tr1 tr2 ) (setq tr1 (vla-copy rg1) tr2 (vla-copy rg2) ) (vla-boolean tr1 acunion tr2) (setq rtn (< (vla-get-area tr1) (+ (vla-get-area rg1) (vla-get-area rg2)))) (vla-delete tr1) rtn )
  26. 1 point
    You might want to consider the program I posted here: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/update-blocks-amp-attributes-lisp/m-p/4423983#M315011
  27. 1 point
    When one starts with pattern definition files and see all the figures, it can be alarming! But each line is limited to 80 characters, and if there is any opportunity to use exact numbers (with fewer than two decimal places) then that saves the number of characters. It is necessary to make use of all those decimal places when the hatch is a long way from the origin otherwise the lines split apart (as you have seen). I do not use any artificial help, but prefer to manually follow the pattern of the definition file (as pictured below). If you draw every thing out it is not hard to pick up all the information to make the hatch file. The first 8 lines, those beginning with 0 or 90 are the block outlines, drawn starting at 0,0. The next 12 lines are the circles. First of all, i drew a 12 sided polygon, and copied it to form the hatch pattern. Using a circle of radius 11, I drew an inscribed and a circumscribed 12 sided polygon, measured the lengths of both, and then decided to use a side length of 5.75 (cutting down on the number of decimal places). Then I projected one of the lines to see where it hit another circle. It doesn't actually hit one, but 15 rows over it nearly hits one. So I altered the angle from 15° to 14.931417°, not a lot, but enough to make the lines to be in line. Then I redrew the polygon using the new angle, and drew the dash line. I then offset this through similar points on the shapes until a pattern emerged from which I can measure the sideways repeat lengths. Then I worked my way around the shape, picking the lengths and angles from the working drawing. Simple! Finally, at the end of the file, I have found that if there is an asterisk at the start of the end line followed by comments, one does not have to leave a blank line at the end of the file.
  28. 1 point
    All linework should be created in model space while all dimensions and text should be in paper space. Well, at least, that is what I would recommend. As for the height of your paper space text, assuming you used the default template for AutoCAD drawings (acad.dwt), and since it is based on the Imperial not Metric system of dimensioning, I would suggest a text height of 0.125 (the decimal equivalent of 1/8th inch). One other suggestion. Text and dimensions should be on their own separate layers with distinctly different colors. Consult the instructions P-F provided you.
  29. 1 point
    Hi Yash, This is a way to do it without using the (command) feature using your original code: (defun c:rects ( / a b c dataline f x) (setq f (open "D:/3DY/FromAutoCAD/Circle.csv" "r")) (setq dataline (read-line f)) (setq dataline (read-line f)) (setq x 1) (setq a 0) (setq b 0) (setq c 0) (while (/= dataline "EOF") (setq dataline (vl-string-trim " " dataline)) (cond ((= (rem x 3) 0) (setq c (mapcar 'atof (JH:str->lst dataline ","))) (3Darc a b c) ) ((= (rem x 3) 1) (setq a (mapcar 'atof (JH:str->lst dataline ","))) ) ((= (rem x 3) 2) (setq b (mapcar 'atof (JH:str->lst dataline ","))) ) ) (setq x (+ 1 x)) (setq dataline (read-line f)) ) (close f) ) (defun 3DArc (p1 p2 p3 / cen n1 m1 m2 z1 z2 z3) (setq n1 (vx1 (v^v (mapcar '- p1 p2) (mapcar '- p3 p2)))) (mapcar '(lambda (x z) (set z (mapcar '(lambda (y) (if (< (abs y) 1e-8) 0.0 y) ) (trans x 0 n1) ) ) ) (list p1 p2 p3) '(z1 z2 z3) ) (setq m1 (mapcar '(lambda (x y) (/ (+ x y) 2.0)) z1 z2) m2 (mapcar '(lambda (x y) (/ (+ x y) 2.0)) z2 z3) cen (inters m1 (polar m1 (+ (* 0.5 pi) (angle z1 z2)) 1) m2 (polar m2 (+ (* 0.5 pi) (angle z2 z3)) 1) nil ) ) (entmake (list '(0 . "ARC") (cons 10 cen) (cons 40 (distance cen z1)) (cons 50 (angle cen z3)) (cons 51 (angle cen z1)) (cons 210 n1) ) ) ) (defun v^v ( u v ) (list (- (* (cadr u) (caddr v)) (* (cadr v) (caddr u))) (- (* (car v) (caddr u)) (* (car u) (caddr v))) (- (* (car u) (cadr v)) (* (car v) (cadr u))) ) ) (defun vx1 ( v ) ( (lambda ( n ) (if (equal 0.0 n 1e-10) nil (mapcar '/ v (list n n n)))) (distance '(0.0 0.0 0.0) v) ) ) ;; JH:str->lst --> Jonathan Handojo ;; Parses a string into a list using a specified delimiter ;; str - string to parse ;; del - delimiter string (defun JH:str->lst (str del / l rtn src) (setq l (1+ (strlen del))) (while (setq src (vl-string-search del str)) (setq rtn (cons (substr str 1 src) rtn) str (substr str (+ src l)) ) ) (reverse (cons str rtn)) ) Heck why am I even doing so much work for something that can be solved using the (command) feature, lol
  30. 1 point
    Thanx for the lunch break Grrr... wish I had the time , its full moon and still working to get something finished for my colleagues tomorrow... even have no time to go witch hunting now boehoehoe Still I wonder , how are you gonna populate such a dialog , what kind of data would need such a construction. Seems a little academic? Well, back to work , hope I'm finished bee-4 the sun rises
  31. 1 point
    or you can hit a check into this box.
  32. 1 point
    There is some comments about BPOLY not being a vba command so try ThisDrawing.SendCommand "Bpoly" & vbCr also ThisDrawing.SendCommand "-Boundary" & vbCr & pt vbCr "NOT TESTED" Lisp version (command "-boundary" pt "")
  33. 1 point
    Yes, Lee, yours is better... (I am not sure if (vl-string-trim) would trim more characters than it should... If I may revise my version : (defun foo ( strlst / findpre itm pre suf a b ) (defun findpre ( strlst k / str ) (if (null itm) (setq itm (car strlst)) ) (setq str (substr itm 1 k)) (if (vl-every '(lambda ( x ) (wcmatch x (strcat str "*"))) strlst) (findpre strlst (1+ k)) (substr str 1 (1- (strlen str))) ) ) (setq pre (findpre strlst 1)) (setq itm nil) (setq strlst (mapcar 'vl-list->string (mapcar 'reverse (mapcar 'vl-string->list strlst)))) (setq suf (vl-list->string (reverse (vl-string->list (findpre strlst 1))))) (setq a (strlen pre)) (setq b (strlen suf)) (setq strlst (mapcar 'vl-list->string (mapcar 'reverse (mapcar 'vl-string->list strlst)))) (setq strlst (mapcar '(lambda ( x ) (substr x (1+ a) (- (strlen x) a b))) strlst)) ;;; This line is better (Thanks Lee) (list pre strlst suf) ) ;;; (foo '("Level 1 Floor Plan" "Level 2 Floor Plan" "Level 2b Floor Plan" "Level 3 Floor Plan")) ;;; ("Level " ("1" "2" "2b" "3") " Floor Plan")
  34. 1 point
    I think I see what you're after... (defun c:test ( / i rtn ss tags) (setq tags ; these are the tags. They will appear left to right sorted in the order below '( "DESC-S" "PTNO-S" "QTY-S" ) ) (if (setq ss (ssget '((0 . "INSERT")))) (progn (repeat (setq i (sslength ss)) (setq rtn (cons (mapcar 'cdr (vl-sort (vl-remove nil (mapcar '(lambda (x / ps) (if (setq ps (vl-position (vla-get-TagString x) tags)) (cons ps (vla-get-TextString x)) ) ) ((lambda (x) (append (vlax-invoke x 'GetConstantAttributes) (vlax-invoke x 'GetAttributes))) (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ) ) ) '(lambda (a b) (< (car a) (car b))) ) ) rtn ) ) ) (JH:list-to-table (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))) (append '(("Data Extraction")) (list tags) (vl-remove nil rtn)) (getpoint "\nSpecify insertion point for table: ") (getvar 'ctablestyle) ) ) ) ) ;; JH:list-to-table --> Jonathan Handojo ;; Creates a table from a list of lists of strings ;; space - ModelSpace or Paperspace vla object ;; lst - list of lists where each list is a list of strings ;; => if you wish to insert a block in the cell, prefix using "<block>" followed by the block name ;; => e.x. if you want to insert the block "TestBlock1", input the string as "<block>TestBlock1" ;; pt - Insertion point of table (2 or 3 reals) ;; tblstyle - Table style to use (defun JH:list-to-table (space lst pt tblstyle / i j lens ncols rows totlen txt vtable) (setq ncols (apply 'max (mapcar 'length lst)) vtable (vla-AddTable space (vlax-3d-point pt) (length lst) ncols 10 10) ) (vla-put-RegenerateTableSuppressed vtable :vlax-true) (vla-put-StyleName vtable tblstyle) (repeat (setq i (length lst)) (setq rows (nth (setq i (1- i)) lst)) (vla-SetRowHeight vtable i (* 2 (vlax-invoke vtable 'GetCellTextHeight i 0))) (repeat (setq j (length rows)) (setq lens (cons (+ (abs (apply '- (mapcar 'car (textbox (list (cons 1 (setq txt (nth (setq j (1- j)) rows))) (cons 7 (vlax-invoke vtable 'GetCellTextStyle i j)) ) ) ) ) ) (vlax-invoke vtable 'GetCellTextHeight i j) ) lens ) ) (if (eq (strcase (substr txt 1 7)) "<BLOCK>") (progn (setq blk (substr txt 8)) (if (and (wcmatch (getenv "PROCESSOR_ARCHITECTURE") "*64*") (vlax-method-applicable-p vtable 'setblocktablerecordid32) ) (vla-SetBlockTableRecordId32 vtable i j (vla-get-ObjectID (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk))) (vla-SetBlockTableRecordId vtable i j (vla-get-ObjectID (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) blk)) :vlax-true) ) ) (vla-SetText vtable i j txt) ) ) (setq totlen (cons lens totlen) lens nil) ) (repeat ncols (vla-SetColumnWidth vtable (setq ncols (1- ncols)) (apply 'max (vl-remove nil (mapcar '(lambda (x) (nth ncols x) ) totlen ) ) ) ) ) (vla-put-RegenerateTableSuppressed vtable :vlax-false) vtable )
  35. 1 point
    Something from me, it can be change for multiple text. (defun c:try1 (/ sel text text2 ) (setq sel (car (entsel "\nSelect some text: "))) (setq text (cdr (assoc 1 (entget sel)))) (setq text2 (vl-list->string (vl-remove 32 (vl-string->list text)))) (entmod (subst (cons 1 text2) (assoc 1 (entget sel)) (entget sel))) (princ) )
  36. 1 point
    It's the variable that's wrong. There's no variable ANGF. So when you tried (* -1 angf), it returns the error you described. (defun c:test ( / ang blkname bpt) (setq blkname "ARROWNORTH") (and (setq ang (getangle "\nSpecify angle or click two points <exit>: ")) (setq bpt (getpoint "\nSpecify arrow location <exit>: ")) (entmake (list '(0 . "INSERT") (cons 2 blkname) (cons 10 bpt) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) (cons 50 (- ang)) ) ) ) (princ) )
  37. 1 point
    Change the Standard text style to a TTF font.
  38. 1 point
    You are trying to multiply the -1 by a string. ANGTOS outputs a string. you have to do the math before you convert the number to a string. The negative 1 will work with radians too so just apply it to the radians angle.
  39. 1 point
    Do you have a pic of what it looks like ? Is it metric, standard, machine screw, self tapping, coarse or fine thread... etc. Once you know what kind it is you pull a search for a chart on it like: ANSI https://www.engineersedge.com/thread_strength/internal_screw_threads_chart.htm Metric https://amesweb.info/Screws/metric-external-thread-dimensions-chart.aspx A set of thread pitch gauges wouldn't hurt Are you wanting to 3D print a screw ? You can buy plastic screws, bolts and nuts https://us.misumi-ec.com/vona2/mech_screw/M3301000000/M3301160000/?listDisplay=mc-photo&msclkid=8b6f01a7321712d305105e02a6f30dab&utm_source=bing&utm_medium=cpc&utm_campaign=FA - Bolts%2FFasteners%2FScrews&utm_term=%2Bplastic %2Bscrews&utm_content=Screws - Plastic
  40. 1 point
    Something like this? (defun C:NA (/ REAL1 REAL2 ARROW ANGF1 ANGF2 NORTH) (if (and (setq REAL1 (getpoint "\nFirst point on background")) ; Real angle point 1 (setq REAL2 (getpoint "\nSecond point on background" REAL1)) ; Real angle point 2 (setq ARROW (getpoint "\nPick arrow basepoint")) (setq ANGF1 (angle REAL1 REAL2)) ; extracting angle - in radians (setq ANGF2 (Angtos (+ ANGF1 pi) 0 2)) ; converting to degrees ;; (setq ANGT (strcat "-" ANGF)) ; attempting to reverse the angle in order to get a mirror image of the angle (setq NORTH (ssget "_:L")) ) (command "Rotate" NORTH "" "_non" ARROW ANGF2) ) (princ) )
  41. 1 point
    Do you have the dcl file that this lisp is supposed to use? If not a large part of the lisp is superfluous and can be removed leaving the attached lisp, which I have renamed to arec. The lisp, as per the original, is set to auto-run when loaded. If you need to run it later it is now "arec" If you have the dcl file, please attach it so i can test the complete package with the changes. arec.lsp
  42. 1 point
    Sorry, my answer was confusing, it should have read replaced (rtos area 2 2) with (rtos (cvunit area "sq m" "sq ft") 2 2) As for running both, copy the original lisp, make the changes to one copy and then rename the functions to c:arem (metres the unchanged one) and c:aref (feet). You will find this a the top of the file in the first function call i.e. (defun c:are ()... (change the red bit)
  43. 1 point
    The drawing has been badly treated, all dimensions exploded, but for some reason what would normally result in lines the dimension lines have been turned into polylines, and many objects that would have been originally blocks are just collections of polylines (WC, chairs etc) was this drwing at some point converted from a PDF?
  44. 1 point
    I have a lot of points as Decimal Degrees, I need code for excel that can help me to 1-remove the duplicate points 2- remove the points with a specific range I can decide Test.xlsx
  45. 1 point
    You are great Bro.
  46. 1 point
    Thank you guys, @PeterPan9720 @lrm I found a way to help my requirements, but I need VBA code to sort data automatically from largest to smallest or vice versa
  47. 1 point
    Does the following do what you want for removing duplicate coordinate pairs? I had the program output the results into columns E and F. The code does not do any error processing and has only been lightly tested. Option Base 1 Sub test() 'Removes Lat Long coordinates pairs that are duplicated within ' a spedified precision. 'LRM 10 / 29 / 2020 Dim LatLong(100, 2) As Variant Dim LatLongNew(100, 2) As Double Dim n As Integer, i As Integer, k As Integer, num As Integer i = 1 msg = "Please enter desired number of decimal places" & vbCrLf & _ "of desired precision." n = InputBox(msg, "Specify Precision", 6) Range("B2:B2").Select While ActiveCell.Value <> "" LatLong(i, 1) = ActiveCell.Value ActiveCell.Offset(0, 1).Select LatLong(i, 2) = ActiveCell.Value ActiveCell.Offset(1, -1).Select i = i + 1 Wend num = i - 1 k = 1 For i = 1 To num - 1 If Round(LatLong(i, 1), n) <> Round(LatLong(i + 1, 1), n) Then If Round(LatLong(i, 2), n) <> Round(LatLong(i + 1, 2), n) Then ' we don't have a duplicate LatLongNew(k, 1) = LatLong(i, 1) LatLongNew(k, 2) = LatLong(i, 2) k = k + 1 End If End If Next i ' Output results Range("E2:F101").Select Selection.ClearContents Range("e2:e2").Select For i = 1 To k - 1 ActiveCell.Value = LatLongNew(i, 1) ActiveCell.Offset(0, 1).Select ActiveCell.Value = LatLong(i, 2) ActiveCell.Offset(1, -1).Select Next i End Sub
  48. 1 point
    Unfortunately still does not work. @PeterPan9720
  49. 1 point
    Thanks your code was helpful @PeterPan9720
  50. 1 point
    From my research, I'd guess that part of the issue is the UCS. Once you change the viewport, start the UCS command and give the View option. Also look at your SNAPANG setting. Another possibility (which may or may not work) is to create a view in model space, where you intend to create your viewport. Then, once you create the viewport, set it to the view.
  • Newsletter

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