Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/23/2021 in all areas

  1. (command "line" "_none" '(0.0 0.0 0.0) "_none" (list 0.0 RW 0.0) "")
    2 points
  2. Yes. vl-sort to the closest distance is probably the most reliable. That code was tailored to the sample drawing.
    1 point
  3. So... if you put something between " it is read as a string, a fixed thing and no calculation is done to work out what it is. You'll need to write it out so that the LISP knows to evaluate that part. To make a point you can use a list, instead of "0,RW" try (list 0 RW) (Command "line" "0,0" (list 0 RW) "") a second way to do this might be to create a string something like: (setq pt (strcat "0," (rtos RW))) (command "line" "0,0" pt "") Here you are making a text string, pt, since RW is a number (or should be?) you need to convert that to a string to join to another string, which is what RTOS does. The reverse is true, if RW is text, and not a number in my first example you;d need to use ATOF Second note here, (strcat "0," (rtos RW))can be put in place of pt in the second line to make your code a bit shorter.
    1 point
  4. You can still use snap tracking to set start point so just change how the 2nd point is found. this will act like snap tracking and ref the start point. (setq cp (getpoint sp "Center Point: ")) ---EDIT--- You can snap track the start point and cp the other way just have to do it twice and add the .5 to the cp
    1 point
  5. (defun c:unfoo nil (layerstate-restore "RJP-NLAYISO" nil 2))
    1 point
  6. Nothing to snap to because nothing is there yet. (maybe nearest) Use extend or trim. I guess you could program the start point, center, draw a circle so their is something to snap to then delete/trim the circle. Beat me too it Emmanuel.
    1 point
  7. See if you're happy with this: After you set the start point and center, the routine draws a temporary circle. Then you can use that circle to find the intersect point (I feel like that intersect point is the main issue). You set that end point, then the arc is drawn, then the circle is removed. (Edit of my code: arcs are always drawn anti clockwise. Maybe you need a clockwise arc, like in your video. In that case type R and press enter at the end ) ;;; entmakex stuff. @see https://www.theswamp.org/index.php?topic=32148.0 (defun drawArc (cen rad sAng eAng) (entmakex (list (cons 0 "ARC") (cons 10 cen) (cons 40 rad) (cons 50 sAng) (cons 51 eAng)))) (defun drawCircle (cen rad) (entmakex (list (cons 0 "CIRCLE") (cons 10 cen) (cons 40 rad)))) ;;;;;;;;;;;;;;;;;;;;;;;;; ;; Custom Draw Arc (defun c:cda ( / sp cp ep tempcircle arc str) (setq sp (getpoint "\nStart point: ")) (setq cp (getpoint "\nCenter point: ")) ;; draw temporary circle (setq tempcircle (drawCircle cp (distance cp sp))) (setq ep (getpoint "\nEnd point: ")) (setq arc (drawArc cp (distance cp sp) (angle cp sp) (angle cp ep))) ;; delete temp circle (entdel tempcircle) ;; Now you might want the reversed start and end (princ ) (setq str (getstring "\nIf you're happy with this arc press enter. If you want the reversed Start/End, then type R: ")) (if (or (= str "r") (= str "R")) (progn ;; delete previous arc, redraw it with reversed angles (entdel arc) (setq arc (drawArc cp (distance cp sp) (angle cp ep) (angle cp sp))) ) ) (princ) )
    1 point
  8. Lines, polylines have a direction. You can draw a line from left to right, or from right to left. Just like polylines have an order of which point came first ... Depending on that the offset can do the opposite thing, depending on whether the distance is positive or negative. Test my code (type a number for getdist instead of setting two points) on the dwg I uploaded. ;; Custom OFFset (defun c:coff ( / mspace myline dist offLine) (vl-load-com) (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq myline (vlax-ename->vla-object (car (entsel "\nSelect object to offset: " )))) (setq dist (getdist "\nOffset Distance : ")) (setq offLine (vla-Offset myline dist)) (princ) ) (princ) offset.dwg
    1 point
  9. Use VBA its in Autocad Bricscad, Microstation to mention a few. Note may need to download the VBA extension module for your version of Autocad.
    1 point
  10. Agree with you tombu we had description as tr6*3 so had post process that would change the block to a dynamic block would draw spread 6m dia and trunk 0.3m dia 2 objects.
    1 point
  11. Here is another way .. checks that there is something within a distance of 1.5 ( based on the sample drawing ). Should be fairly fast (defun c:foo (/ a b c d el r s) ;; RJP » 2021-11-22 (cond ((setq s (ssget "_X" '((0 . "TEXT") (8 . "urb_rasante,CVL_RAS_TX")))) (setq d 1.5) (foreach e (mapcar 'cadr (ssnamex s)) (if (= "CVL_RAS_TX" (cdr (assoc 8 (setq el (entget e))))) (setq a (cons (list (cdr (assoc 11 el)) (cdr (assoc 1 el))) a)) (setq b (cons (list (cdr (assoc 11 el)) e) b)) ) ) (setq a (vl-sort a '(lambda (r j) (< (caar r) (caar j))))) (setq b (vl-sort b '(lambda (r j) (< (caar r) (caar j))))) (while (setq c (car a)) (setq a (cdr a)) (if (vl-some '(lambda (x) (<= (distance (car c) (car (setq r x))) d)) b) (list (entmod (append (entget (cadr r)) (list (cons 1 (cadr c))))) (setq b (vl-remove r b)) ) (entmake (list '(0 . "circle") (cons 10 (car c)) '(40 . 5) '(8 . "NoMatch"))) ) ) ) ) (princ) )
    1 point
  12. For our Tree Description Key set code CRM Point Label Style is "Description Only", Format is "$1" Crape Myrtle", Layer is "V-SITE-VEGE", Scale Parameter 1 checked, Fixed Scale Factor 1 checked, and Apply X-Y Yes checked. Using just a standard tree block a point with "CRM 18" as the description will be scaled 18× and labeled as 18" Crape Myrtle automatically when imported. Pretty simple. To mark a tree as "To Be Removed" or "Technically removed" I use this code saved as "TreeToBeRemoved.lsp" in a folder both in my Support Path and Trusted Folders. ; by: Tom Beauford (defun TBR ( ) ;(defun TBR ( / ss ent obj hscale pt clayer ) (setq ss (ssget "+.:E:S" '((0 . "AECC_COGO_POINT")(8 . "V-SITE-VEGE"))) ent (ssname SS 0) obj (vlax-ename->vla-object ent) east (vlax-get-property obj 'Easting) north (vlax-get-property obj 'Northing) pt (list east north) hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue)) clayer (getvar 'clayer) ) (princ pt)(princ "\n") (if (/= (getvar 'annoallvisible) 1)(progn(setvar 'annoallvisible 1)(princ "\nDisplays all annotative objects. ANNOALLVISIBLE"))) (setvar 'clayer "V-SITE-VEGE") ) ; ^P(or C:TBR (load "TreeToBeRemoved.lsp"));TBR ; (load "TreeToBeRemoved.lsp")TBR (defun C:TBR ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to be Removed ") ; (or C:Steal (load "StealV1-8.lsp")) (TBR) (or(tblsearch "block" "TBR")(command-s "-insert" "TBR" pt hscale hscale "")) (setq hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue))) (princ "\nhscale")(princ hscale) (command-s "-insert" "TBR" pt hscale hscale "") (setvar 'clayer clayer) (princ) ) ; ^P(or C:TCH (load "TreeToBeRemoved.lsp"));TCH ; (load "TreeToBeRemoved.lsp")TCH (defun C:TCH ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to be TeCHnically removed ") ; (or C:Steal (load "StealV1-8.lsp")) (TBR) (or(tblsearch "block" "TCH")(command-s "-insert" "TCH" pt hscale hscale "")) (setq hscale (*(vlax-get-property obj 'XYScale)(getvar 'cannoscalevalue))) (princ "\nhscale")(princ hscale) (command-s "-insert" "TCH" pt hscale hscale "") (setvar 'clayer clayer) (princ) ) ; ^P(or C:CPZ (load "TreeToBeRemoved.lsp"));CPZ ; (load "TreeToBeRemoved.lsp")CPZ (defun C:CPZ ( / ss ent obj hscale pt clayer ) (princ "\nSelect Tree to add CPZ ") (TBR) (setq hscale (vlax-get-property obj 'XYScale)) (princ "\nhscale")(princ hscale) (command-s "_Circle" pt "Diameter" hscale) (setvar 'clayer clayer) (princ) ) to place an Annotative block with Match orientation to layout set to Yes and scaled the same as the selected Civil 3D tree block on top with these macros: ^P(or C:TBR (load "TreeToBeRemoved.lsp"));TBR and ^P(or C:TCH (load "TreeToBeRemoved.lsp"));TCH and ^P(or C:TCH (load "TreeToBeRemoved.lsp"));CPZ Since they're separate blocks placed on top of the Civil 3D tree blocks to change the status just delete whatever TBR or TCH block if you want. You're making this a lot harder than it has to be.
    1 point
  13. Could you add a non-plotting circle to the block and use that diameter for your attribute? You might have to experiment to find the right size for the circle so that it matches the tree (if I'm interpreting the question properly), but once you do that, you've got what you need.
    1 point
  14. Hey BIGAL, Perfect. I threw that in the READVTX lisp code, and it worked exactly as I needed. Like I said I have very limited knowledge of lisp coding, I learned VB and Java in hichschool, so I have a basic understanding of the principles of programming, I just don't really know any lisp syntax. Unfortunately I don't have much time to dedicate to learning it, so help from folks like yourself is greatly appreciated! I attached the final version of the lisp that I will be using to save me tons of time. Thanks again for the help! READVTXDIST.lsp
    1 point
  15. Like tombu I have trunk and spread trees as single dynamic block, if the original block is drawn as 1 unit dia in size then its scale function reflects its size. If its dynamic same thing can get property value that is size and say label. Should post block so can look at it.
    1 point
  16. Why not just take advantage of Civil 3D's features? Our trees are imported scaled by the tree diameters. I have one Tree Description Key set that adds the diameter and description as the label and another that simply puts the point number in the center of the tree as the label referenced by a tree table.
    1 point
  17. That is because your text style "TEXT-" has a height set to 0.1250. If you use the command "style" and select "TEXT-1" and set its height to 0 instead of 0.150 you will then be able to change the height in the attributes editor. Or just create a new text style in the style command, set its height to 0 and have your attribute use that text style.
    1 point
×
×
  • Create New...