Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/28/2024 in all areas

  1. You can change variables so the lisp will work properly with setvar. briscad usually tells you what they are in the properties (getvar 'angdir) when check outputs 1 meaning clockwise unchecked and run again 0 so you want to set angdir to 1 before calculating the angles (setvar 'angdir 1) ;before angle calculations (setvar 'angdir 0) ;set right before you exit lisp to restore your defaults Anyway this should work with 3d polylines using the vlax-curve funcitons ;;----------------------------------------------------------------------------;; ;; Function to place block on vertices of 2d and 3d polyines ;; Note: Angle directin is set to clockwise after running ;; https://www.cadtutor.net/forum/topic/81001-insert-blocks-at-the-vertices-of-the-polyline-and-align-to-the-segments/#comment-631547 (defun c:foo (/ blk mspace i p1 p2 ang sca ss) (vl-load-com) ;Check that we have the block to insert (if (tblobjname "block" (setq blk "spot")) (progn (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (prompt "\nSelect POLYLINE: ") (setvar 'angdir 1) (if (setq ss (ssget '((0 . "*POLYLINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (setq i 0) (while (< i (vlax-curve-getEndParam ent)) ;get the number of vertex in the polyline (setq p1 (vlax-curve-getPointAtParam ent i) ;get point at i p2 (vlax-curve-getPointAtParam ent (1+ i)) ;get point at next vertex ang (angle p1 p2) ) (setq i (1+ i)) (vlax-invoke mspace 'insertblock p1 blk 1 1 1 ang) ) ) ) ) (alert (strcat "\n" blk " needs to exist in drawing!")) ) (setvar 'angdir 0) (princ) )
    1 point
  2. I turn off ''clockwise'' in the units, use (setvar 'Angdir 1) and reset it, though I very rarely have to use it, so without going through code why would you need to use it. 3D polys can cheat and use the XY co-ords only for angle but insert at 3D XYZ.
    1 point
  3. @DELLA MAGGIORA YANN Great! I am glad it's working for you. Note - the program is completely dependant on the selected units. If you want it to show in kg/m3, just temporarily change the units at the top to "Meters" and it will update the density in real-time, then you can change it back to "millimeters" for the correct object weight to be displayed. I like this program and I may revisit the program at sometime in the near future and re-write it for more features, but for now this will have to do for you.
    1 point
  4. @ILoveMadoka The problem I see with this approach is you will not have any control on the order that SSGET selects the objects (unless you still pick them one at a time), and you might not get the sequential order you want. You would need some type of code to sort the selected entities by some other criteria, such as location.
    1 point
  5. 99% of code works with Briscad. A few things but you find them, as new versions come out some of the problems go away. Something I use is the convert dcl to lisp by RLX then you have only 1 file, as the dcl lives in the lsp. Convert dcl 2 lisp rlx.lsp
    1 point
  6. I believe any command that is built-in to AutoCAD is proprietary product and cannot be disclosed to the public. However, some built-in AutoLISP commands, for example, the Express Tools of AutoCAD, are all saved in your local computer and can be viewed anytime under your directory "C:\Program Files\Autodesk\AutoCAD 2021\Express" (assuming your CAD version is 2021). Anyways, that aside, just as the previous comment suggested, finding a point that overlaps with basically any curve is relatively easy. But finding the overlaps of two curves, even between two polylines as shown below, is not easy.
    1 point
  7. Edited Above Again and localized all the variables.
    1 point
  8. EDIT: Updated my above Alteration to also use Region boundaries and subtracting islands (for example: holes in the plate) for a better way to get areas than just getting single polyline boundaries. I also added a couple more materials. I will probably go back later and localize everything, as Jeffrey's original program has NO localized variables.
    1 point
  9. You can have 2 mviews on top of each other, bit odd request we always drew Design in Model over the top of existing, good layer control helps. The existing was grey and design black or color. Matches your image.
    1 point
×
×
  • Create New...