Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. alanjt

    Curb offset

    I thought about using MLines, but decided against it because once I offset, I'm generally modifying to draw in curb ramps, etc. I've considered using different layers, but I've never been able to get other people on board. Might be time to give it another attempt. For grading, I have a separate program I wrote that creates my featureline curb offsets based on a selected featureline.
  3. Sometimes the extension lines of associative dimensions are stretched (for example, to the origin of coordinates ) when inserted into another drawing. Now I've found a way to disable size associativity, but I don't really like it. I only find out that the dimensions have lost their connection with the object when I insert them into another drawing (or turn on the annotation monitor). So I thought it would be possible to align the extension lines to a smaller extension line. Maybe there is a better way... ; disable associativity of only selected sizes (defun c:DimAssOf ( / ss) (vl-load-com) (prompt "\nSelect DIMENSION to disable associativity: ") (setq ss (ssget '((0 . "DIMENSION")))) (if ss (progn (command "_.DIMDISASSOCIATE" ss "") (prompt (strcat "\nThat's it: associativity is disabled for " (itoa (sslength ss)) " Dimensions." ) ) ) ) (princ) ) extension lines.dwg
  4. I'm guessing they have a drawing and want all the long blue dim extension lines to be shortened to where the dimension is. but the top blue one looks like its pulling from the right and left like the dimension itself is inside the feature its measuring. were the bottom red is only pulling from the right.
  5. Today
  6. I don't think we've understood your question yet (at least I haven't). You might need to elaborate a bit and add some more images.
  7. I only did a quick peek since I am busy and haven't used SolidWorks in quite a while, but it looked like a pretty easy change. I am sure a deeper dig on the forums would show the process for updating, but I really didn't have time to look harder into it.
  8. Another way. this doesn't repeat but uses ldata so the user can just hit enter if they aren't changing the offset from last value inputted. Has to have an existing polyline to run and the new end point. will only update the last two closest points of the old polyline to the new end point. Route.mp4 Route.lsp
  9. Yesterday
  10. BIGAL

    Trying to adjust point marker location

    This is cut out of a CIV3D lisp for write text height of a cogo point. (alert "Pick CIV3D points press ESC or pick nothing to exit") (while (setq obj (vlax-ename->vla-object (car (entsel)))) ; vl 3d point convert to plain lisp (setq pt1 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj "Location")))) Not sure but you may be able to put "Location".
  11. Added to my to do list may be a couple of days. 1st comment would do alphabetically for objects. So Mtext is before Text. You are lucky that I have get objects properties code.
  12. Err now i don't want to update to 2026 have alot of save macros that work alongside PDM.
  13. Hi, How can I ensure that vlax-curve-getClosestPointToProjection returns the closest point in every case? I suspect that the curve is merging in the projected plane and therefore it does not always return the closest point in the desired direction. Alternatively, I could probably use vla-IntersectWith method with a line object and find the closest point, but I'm using grread where vlax-curve-getClosestPointToProjection will be more appropriate, I don't have to create and delete line objects in while loop. Animation.apng Drawing1.dwg sline2_dev_v2.lsp
  14. Hello everyone. You need to select several sizes and align the extension lines to the short line of each selected size. Maybe there is such a program?
  15. From what I quickly look into on the Dassault Systems (SolidWorks) site, among other changes for SolidWorks 2025 API, there was a change in the methods for saving a drawing. My WAG is that's where the VBA is failing on SolidWorks 2025, could be another change as well.
  16. I would start by drawing five circles R10. Then two circles R4 using TTR. Then trim to suit.
  17. We use point styles with markers (which are blocks) instead of separate entities (which are also blocks) to show utility equipment like hydrants and valves. At least, the surveyors do. The engineers turn off the markers and insert blocks nearby to reduce clutter. That seems clunky to me. I would like to be able to offset a marker, the way you can rotate a marker, and put it somewhere nearby. I get that you can't just add a property to a Civil3D object, so we'd add user-defined properties for X and Y. So far so good. Where I get stuck is changing the position of the marker in relation to the point. You can change the insertion point of the block, but that applies to every instance. Dynamic blocks might work, but there would have to be a way to protect the dynamic parameters and actions from anyone who tries to change the block. You'd have to adjust the rotation every time you changed the position, and vice versa. It seems like more trouble than it's worth, but if there's something simple I'm missing, I'd appreciate any suggestions.
  18. How far should the centers of the radius-10 circles be from the center? In other words, how do you place the tabs (or whatever you call those circular protrusions)? It looks like the left and right sides of the central tab are different. Should they be symmetric? Once you place the tab circles, you should be able to draw the radius-4 circles as tangent to two of the tabs. Then it's just a matter of trimming. Here's what I got with the tabs placed on the diameter-80 arc:
  19. dexus

    Hybrid parallel

    In the voronoi version some error checking before trying to call _polyline should be added indeed. And this function is dependent on how well the points are distributed over the line (ent->pts function). For the lines close together, more points should be given and with crossing lines it will not work at all. It only works if the lines stay in between the two polylines, and it doesn't in the example from OP:
  20. dexus

    Hybrid parallel

    Thanks. The animation in the GIF is from the calculations made in _cornerOffset. When it was (finally ) working I replaced the animation code with error checking. Didn't take the time to make it do both, but I did want to show how it worked here.
  21. GLAVCVS

    Hybrid parallel

    I think you're doing a very good job. PS: The animation in the GIF doesn't look the same as the one in the code.
  22. Aftertouch

    Export layers with objectdata to GIS format

    @SLW210 here is a sample DWG Sample.dwg There are 4 'Object Data' tables in this DWG. I'd like to see each 'AutoCAD layer' on its own 'QGIS' layer, including only the assigned Object DATA'. MAPEXPORT only seems to allow to export all object data for some reason.
    When will this awesome tool be available for AutoCAD 2026?
  23. Yea with the resent forced update in windows 11 some things went funky for people.
  24. Also noticed the CopyToClipboardAPI can be replaced with three lines if you add a reference to Microsoft Forms 2.0 Object Library Dim obj As New MSForms.DataObject ... If description <> "_" Then obj.SetText description obj.PutInClipboard MsgBox "Description '" & description & "' copied to clipboard." Else
  25. SLW210

    Hybrid parallel

    I'm still sorting an attempt at the Bowyer–Watson version, but first I am trying to sort a few that are getting close. The export CSV and import a centerline is very close, but on the AxisExample .dwg it has a zig-zag glitch. I have one that draws the bisector lines that's close, but still misses the midpoint coming around those turns. I do have the one that appears very accurate on bends in one direction and the bends in the opposite direction depending on pick order. This would work if the AxisExample.dwg was in separate sections at the turns, maybe. I get a error: bad argument type: fixnump: nil with the AxisExample.dwg and some other errors on the original Example.dwg (Two vertices were added to a 2D pline (0) which had no vertices. and error: bad argument type: numberp: nil ) though the simple ones it draws the centerline with @marko_ribar's version. Every one of these fall short on the OPs AxisExample drawing, most in the same areas. So, I will probably keep at this for a while to see how close I can get it. For sure, nearly everyone of these are as good as and many much better than, the currently available solutions in AutoCAD. The solution suggested by Autodesk, PathAverage.lsp by Kent Cooper, fails miserably on most of the OP's examples, though seems to work in most cases and needs the polylines in the same direction. I still have work to do for my paying job, but hopefully I can bang out something soon.
  26. dexus

    Hybrid parallel

    I added extra checks on every vertex like @PGia suggested two weeks ago. Those I added to the offset-loop and it gives the best of both worlds. Every point that is calculated should be the exact middle because the offset is the same on both sides. Still not perfect, but pretty close I think. ;| ; Calculate centerline between two polylines - dexus ; Function checks intersections of the offsets of two lines to create a middle/avarage line. |; (defun c:cl (/ ent1 ent2 loop maxlen offset offsetdistance pts s1 s2 ss start LM:ProjectPointToLine LM:intersections _addPoints _avarageAngle _cornerOffset _doOffset _getAnglesAtParam _getLength _polyline _side _wait) (defun _polyline (pts) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length pts)) (cons 8 (getvar 'clayer)) (cons 70 0) ) (mapcar (function (lambda (x) (cons 10 x))) pts) ) ) ) (defun _side (pline pnt / cpt end target der) (setq cpt (vlax-curve-getClosestPointTo pline pnt) ; https://www.theswamp.org/index.php?topic=55685.msg610429#msg610429 end (vlax-curve-getEndParam pline) target (vlax-curve-getParamAtPoint pline cpt) der (if (and (equal target (fix target) 1e-8) (or (vlax-curve-isClosed pline) (and (not (equal (vlax-curve-getStartParam pline) target 1e-8)) (not (equal end target 1e-8))) ) ) (mapcar '- (polar cpt (angle '(0 0) (vlax-curve-getFirstDeriv pline (rem (+ target 1e-3) end))) 1.0) (polar cpt (angle (vlax-curve-getFirstDeriv pline (rem (+ (- target 1e-3) end) end)) '(0 0)) 1.0) ) (vlax-curve-getFirstDeriv pline target) ) ) (minusp (sin (- (angle cpt pnt) (angle '(0.0 0.0) der)))) ) ;; Intersections - Lee Mac ;; mod - [int] acextendoption enum of intersectwith method (defun LM:intersections ( ob1 ob2 mod / lst rtn ) (if (and (vlax-method-applicable-p ob1 'intersectwith) (vlax-method-applicable-p ob2 'intersectwith) (setq lst (vlax-invoke ob1 'intersectwith ob2 mod)) ) (repeat (/ (length lst) 3) (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn) lst (cdddr lst)) ) ) (reverse rtn) ) (defun _getLength (ent) (- (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) (vlax-curve-getDistAtParam ent (vlax-curve-getStartParam ent)) ) ) (defun _wait (msec) (not ( (lambda (start) (while (< (- (getvar 'millisecs) start) msec)) ) (getvar 'millisecs) ) ) ) (defun _addPoints (lst ent pts / len) (setq len (_getLength ent)) (setq lst (mapcar (function (lambda (pt) (list (/ (vlax-curve-getDistAtPoint ent pt) len) pt))) lst)) (setq pts (append lst pts)) ; Animation ; (setq pts (vl-sort pts (function (lambda (a b) (< (car a) (car b)))))) ; (redraw) ; ( ; (lambda (lst) ; (while (cadr lst) ; (grdraw (cadar lst) (cadadr lst) 3) ; (setq lst (cdr lst)) ; ) ; ) ; pts ; ) ; (vla-update ent) ; (_wait 40) ; End animation pts ) (defun _doOffset (offset / te1 te2 lst rtn) ; Global vars: pts ent1 ent2 s1 s2 (setq rtn (cond ((equal offset 0.0 1e-4) (if (setq lst (LM:intersections ent1 ent2 acExtendNone)) (setq pts (_addPoints lst ent1 pts)) ) lst ) ( (or ; Make offset (vl-catch-all-error-p (setq te1 (vl-catch-all-apply 'vlax-invoke (list ent1 'Offset (if s1 offset (- offset)))))) (vl-catch-all-error-p (setq te2 (vl-catch-all-apply 'vlax-invoke (list ent2 'Offset (if s2 offset (- offset)))))) (vla-put-color (car te1) 252) (vla-put-color (car te2) 252) ) (princ "\nOffset failed. ") nil ) ((setq lst (LM:intersections (car te1) (car te2) acExtendNone)) (setq pts (_addPoints lst (car te1) pts)) lst ) ) ) (if (and te1 (not (vl-catch-all-error-p te1))) (mapcar 'vla-delete te1)) (if (and te2 (not (vl-catch-all-error-p te2))) (mapcar 'vla-delete te2)) rtn ) ;| ; Project Point onto Line - Lee Mac ; @Param pt point to project ; @Param p1 first point of line ; @Param p2 second point of line ; @Returns projected point |; (defun LM:ProjectPointToLine ( pt p1 p2 / nm ) (setq nm (mapcar '- p2 p1) p1 (trans p1 0 nm) pt (trans pt 0 nm)) (trans (list (car p1) (cadr p1) (caddr pt)) nm 0) ) (defun _getAnglesAtParam (ent pa / ang1 ang2) (if (and (vlax-curve-isClosed ent) (= pa 0)) ; Special case for closed Polyline (list (setq ang1 (vlax-curve-getFirstDeriv ent 1e-14)) (setq ang2 (vlax-curve-getFirstDeriv ent (- (fix (vlax-curve-getEndParam ent)) 1e-14))) ) (list (setq ang1 (vlax-curve-getFirstDeriv ent (+ pa 1e-14))) (setq ang2 (vlax-curve-getFirstDeriv ent (- pa 1e-14))) ) ) (setq ang1 (angle '(0 0 0) ang1)) (setq ang2 (angle '(0 0 0) ang2)) (list ang1 (* (+ ang1 ang2) 0.5) ang2) ) ;| ; Avarage Angle - dexus ; Get angle of a line between two angles ; @Param ang1 real - Angle in radians ; @Param ang2 real - Angle in radians ; @Returns real - Angle in radians |; (defun _avarageAngle (ang1 ang2) (if (< (rem (+ ang1 pi) (+ pi pi)) (rem (+ ang2 pi) (+ pi pi)) ) (+ (* (- ang2 ang1) 0.5) ang1) (+ (* (- ang1 ang2) 0.5) ang2) ) ) ;| ; Calculate exact offset distance on a corner - dexus ; pt1 - Point on corner ; pt2 - Point on other side ; pt3 - Center for bisector ; pt4 - Target for corner of the offset ; pt5 - Find perpendicular point for offset distance ; / ; / ; -------- pt1 pt5 ; \ / ; pt4 ; \ ; ---- pt3 ----- pt2 ----- ; ; @Param ent1 Line to check corners ; @Param ent2 Opposing line ; @Returns List of offset distances (pt1 -> pt5) to calculate |; (defun _cornerOffset (ent1 ent2 / ang1 ang2 ang3 index pt1 pt2 pt3 pt4 pt5 rtn tmp vertex) (setq vertex (fix (vlax-curve-getEndParam ent1)) halfPi (* pi 0.5) index 0) (repeat vertex (and (setq pt1 (vlax-curve-getPointAtParam ent1 index)) ; Point on corner (setq ang1 (_getAnglesAtParam ent1 index)) ; Angles of pt1 (setq tmp ; Temp line for finding the angle on the other side (entmakex (list '(0 . "line") (cons 10 (polar pt1 (+ (cadr ang1) halfPi) maxlen)) (cons 11 (polar pt1 (- (cadr ang1) halfPi) maxlen)) ) ) ) (setq pt2 (car (LM:intersections (vlax-ename->vla-object tmp) ent2 acExtendNone))) ; Point on other side (setq ang2 (_getAnglesAtParam ent2 (vlax-curve-getParamAtPoint ent2 pt2))) ; Angle of pt2 (if (equal (rem (car ang1) pi) (rem (car ang2) pi) 1e-9) ; Is parallel? (setq pt3 (mapcar (function (lambda (a b) (* (+ a b) 0.5))) pt1 pt2) ; Midpoint ang3 (car ang1)) ; Same angle als ang1 (setq pt3 (inters pt1 (polar pt1 (car ang1) 1) pt2 (polar pt2 (car ang2) 1) nil) ; Find center for bisector ang3 (_avarageAngle (angle pt1 pt3) (angle pt2 pt3))) ; Angle of bisector ) (setq pt4 (inters pt3 (polar pt3 ang3 1) pt1 (polar pt1 (+ (cadr ang1) halfPi) 1) nil)) ; Find target for corner of the offset (setq pt5 (LM:ProjectPointToLine pt4 pt1 (polar pt1 (+ (car ang1) halfPi) maxlen))) ; Find perpendicular point for offset distance (setq rtn (cons (distance pt1 pt5) rtn)) ; Return offset distance ) (if (entget tmp) (entdel tmp)) (setq index (1+ index)) ) rtn ) (if (not (while (cond ((not (setq ss (ssget '((0 . "LWPOLYLINE"))))) (princ "\nNothing selected. Try again...\n") ) ((/= (sslength ss) 2) (princ "\nSelect 2 polylines! Try again...\n") ) ((and (setq ent1 (ssname ss 0)) (setq ent2 (ssname ss 1)) (setq ent1 (vlax-ename->vla-object ent1)) (setq ent2 (vlax-ename->vla-object ent2)) ) nil ; Stop loop ) ) ) ) (progn (setq s1 (_side ent1 (vlax-curve-getStartPoint ent2))) (setq s2 (_side ent2 (vlax-curve-getStartPoint ent1))) (setq maxlen (* 1.1 (max (_getLength ent1) (_getLength ent2) (distance (vlax-curve-getStartPoint ent1) (vlax-curve-getStartPoint ent2))))) (setq offsetdistance (/ maxlen 1024.0)) (if (LM:intersections ent1 ent2 acExtendNone) (setq offset (- maxlen)) (setq offset 0.0) ) (mapcar '_doOffset (_cornerOffset ent1 ent2)) (mapcar '_doOffset (_cornerOffset ent2 ent1)) (while (progn (setq loop (cond ((> offset maxlen) nil) ((_doOffset offset) (setq start t)) ((not start) t) (start nil) ) ) (setq offset (+ offset offsetdistance)) loop ) ) (if pts (_polyline (mapcar 'cadr (vl-sort pts (function (lambda (a b) (< (car a) (car b))))))) ) ) ) (redraw) (princ) )
  1. Load more activity
×
×
  • Create New...