Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/25/2024 in all areas

  1. (let ... ) is not a function that belongs to vanilla AutoLISP / VisualLISP... Change it to something that belongs to some adequate function from AutoCAD AutoLISP...
    1 point
  2. I think it has been well explained, but just to say this, here you are trying to make a polyline with just two points, think about the case where you have more points (which is usually the case with polylines), so the argument has to be a variant (array of doubles)
    1 point
  3. If you want to avoid variants, you can do like this. The code is minimalist. (defun c:line2pline ( / AcDoc Space ss line-ent st-point en-point l_pt) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (eq (getvar "CVPORT") 1) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) ) (while (setq ss (ssget "_:S+." '((0 . "LINE")))) (setq line-ent (ssname ss 0) st-point (vlax-curve-getStartPoint line-ent) en-point (vlax-curve-getEndPoint line-ent) l_pt (apply 'append (mapcar '(lambda (x) (list (car x) (cadr x))) (list st-point en-point))) ) (vlax-invoke Space 'AddLightWeightPolyline l_pt) (entdel line-ent) ) (prin1) )
    1 point
  4. You are using qouted lists that AutoCAD literarily read... Instead of this, you have to say to CAD that the lists in final line has to be evaluated... So, instead of this line : (command "_.move" CIRSWEEP "" "_non" '(0 0 0) "_non" '(0 0 CHANGEHEIGHT)) You should write it like this : (command "_.move" CIRSWEEP "" "_non" (list 0 0 0) "_non" (list 0 0 CHANGEHEIGHT)) That's all - it should work now as expected...
    1 point
  5. A start a Group can be accessed (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Groups doc)(alert (vla-get-name lay)) (vlax-for lay (vla-get-Groups doc)(vlax-dump-object lay)) ; when you look at ; Count (RO) = 4 the 1 object I created is 4 lines. I have some code somewhere need to find to go next level deeper and get the 4 objects.
    1 point
  6. Leeeeeeee! Tell me what you think about that (defun test2 ( *SEL* / i e VLobj) (repeat (setq i (sslength *SEL*)) (setq e (ssname *SEL* (setq i (1- i))) VLobj (vlax-ename->vla-object e) ) (princ "item #")(princ i)(princ ": Result of dumpallproperties: \n") (dumpallproperties e) (princ "\n\nitem #")(princ i)(princ ": Result of vlax-dump-object: \n")(vlax-dump-object vlobj) (princ "\n*******END OF ITEM #")(princ i)(princ "\n\n") ) (if zzz (setq zzz nil)) (princ) ) Then try adding a custom button in a toolbar, and as a macro add that ^C^C(if (setq zzz (ssget "_X" '((0 . "drawingview"))))(TEST2 ZZZ)(princ "no selection found!"))(princ) To dump properties, it works! Now what I have to figure out is if properties can be modified in the same manner... I didnt have much luck so far to retrieve them, because the props I need are only available with lisp (dumpallproperties) and not with (vlax-dump-object). I tried to retrieve the scale but didnt manage.. Here'S what i tried to add in my repeat (setq scale (getpropertyVALUE e 'CustomScale)) but it did not return anything... I'm not even sure I'm doing the correct thing, ill have to make some research on that, unless you shed some light on how to retrieve/modify them. i guess that only properties seen with (vlax-dump-object) can be retrieved/modified with (vla-get-property) and (vla-put-property) ?? For now I need to retrieve all the drawing views scales, and supress some. I'll sleep on that for tonight, ill dig further in tomorrow. In the meantime, if you investigate on that, i'll be glad to read what your discoveries were... I hope my findings can be usefull...
    1 point
  7. This seemed like a fun challenge, so I thought I might participate... Here is my version: The attached program will prompt for a rectangular closed LWPolyline and a 'wire spacing' (the distance between the coils), and will generate a maximal filleted spiral centered within the selected LWPolyline. The program should perform successfully with all rectangular closed LWPolylines, at any rotation or orientation, and in all UCS & Views. For an arbitrary rectangle of any dimension, one cannot specify both the spacing between the coils and the offset from the rectangle boundary, since multiples of these values will not necessary equate to the rectangular dimensions. Hence, my program will prompt for the spacing between the coils and will center the spiral within the selected rectangular LWPolyline, maximising the number of spiral coils for the given spacing, with the division remainder equal to the offset from the boundary. If the spacing is a multiple of the dimensions of the boundary, the program will offset the spiral from the boundary by the given spacing to ensure that the coils do not touch the boundary edge. The code isn't pretty, but should hopefully perform correctly. Interesting challenge! HeatGridV1-0.lsp
    1 point
×
×
  • Create New...