Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/13/2023 in all areas

  1. Hello everyone, I've been coding a lot the past few days and I just wanted to share my code for those who may have some use for them, and also for me to keep track of my progress. ;********************************************************; ;; MA:perp-test - Test if two angles are perpendicular ;; Arguments: ;; - a (float): First angle in radians ;; - b (float): Second angle in radians ;; - tol (float): Tolerance value for comparison ;; Returns: ;; - test (bool): True if the angles are perpendicular within the given tolerance, False otherwise ;; Usage: (MA:perp-test a b tol) (defun MA:perp-test (a b tol / test) (if (and a b tol) (if (< (abs (- (abs (cos a)) (abs (sin b)))) tol) (setq test T) (setq test nil) ) ) ) This is a very simple script for when you want to compare two angles, especially of blocks you're working with. This can be modified to where it has a default tolerance value for orthogonality, but that would be a good exercise for you guys to test for yourselves.
    1 point
  2. If you can build a 3D model in paper space, you can almost always create a viewport that will give you the shot you need. For one thing, you can create clipping planes and link them to a view, which you can then link to a viewport. That will exclude any objects that are not between the planes. A view, by the way, is a more precise way to create a viewport scene than with the basic viewport controls. You can also tailor a viewport to adjust layer colors, visual styles (such as conceptual and realistic), and other factors to get the look you want. It's one of those topics that's easy to learn but hard to master. The more information you can give us, the better we can help you.
    1 point
  3. See if this helps: Copy and paste hangs for a long time or fails to work in AutoCAD Does it fail on Copy or are you Pasting when it fails? What are the computer specifications and operating system used? AutoCAD 2013 is pretty old and if running on a newer system there could be issues with compatibility. Have you tried other methods to copy the files? Did you create the files or someone else?
    1 point
  4. ReMark will be along shortly, once he's had his coffee. He's our resident PF expert. Good luck with your projects. Welcome to the forum!
    1 point
  5. You probably don't have layer called "Layer", I'm guessing But I don't understand what exactly should be result of this code, I can't figure out from the photo. I think you should just check text group code 72, test how its justified and then determine insertion point of arrow. Here you can see the codes: http://docs.autodesk.com/ACD/2014/ENU/index.html?url=files/GUID-62E5383D-8A14-47B4-BFC4-35824CAE8363.htm,topicNumber=d30e678406 Edit: here is some quick code, when you select text if its left justify it creates arrow on left that is right justified to point from left to text, if you choose right justified text it creates arrow from right that is justified left to point from right side to text. Depending on what you need you can modify that simple code, if I understood the problem correctly here. (setq text (car (entsel))) (setq textJust (cdr (assoc 72 (entget text)))) (cond ((= textJust 0);left (setq insertpt (cdr (assoc 10 (entget text)))) (command "_TEXT" "j" "R" insertpt 1 0 "-->") ) ((= textJust 2);right (setq insertpt (cdr (assoc 11 (entget text)))) (command "_TEXT" "j" "L" insertpt 1 0 "<--") ) );cond
    1 point
  6. (setq ..... _) wants a variable such as (setq brgZ ......) In your example you are giving it a value rather than the variable
    1 point
  7. oh yeah, checking if one's cosinus is the other's sinus (absolute value). I'll steal this one.
    1 point
  8. Read this: https://www.afralisp.net/autolisp/tutorials/list-manipulation.php You want the subst function. Syntax : (subst newitem olditem lst) in your example (setq brgZ (subst (+ 1 (cadr brgZ)) (cadr brgZ) brgZ) )
    1 point
  9. I'm assuming those are those are the attribute tag names. see if this works. (defun c:BlkUpdate ( / typ str blk) (vl-load-com) (initget "Prefix Suffix") (setq typ (cond ((getkword "\nAdd Prefix or Suffix? [<Prefix>/Suffix]: ")) ("Prefix"))) (setq str (getstring t (strcat typ " to Add: "))) (setq blk (car (entsel "\nSelect Block: "))) (foreach att '("WEJ_1" "WEJ_2" "WEJ_3" "WEJ_4" "WYJ_1" "WYJ_2") (if (and (eq typ "Prefix") (> (strlen (setq x (getpropertyvalue blk att)) 0)) (setpropertyvalue blk att (strcat str x)) (setpropertyvalue blk att (strcat x str)) ) ) (vla-Regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports) )
    1 point
  10. Even simpler Yet. but only works with newer versions of AutoCAD. also setpropertyvalue! (defun c:pru (/) (while (setq blk (car (entsel "\nSelecciona bloque: "))) (princ (getpropertyvalue blk "DATO2")) ) )
    1 point
×
×
  • Create New...