Jump to content

Leaderboard

Popular Content

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

  1. This can be used to find Gcen (setq pt (osnap (vlax-curve-getStartPoint obj) "gcen")) That should be enough to get you started. obj is a vl object.
    1 point
  2. Thank You for all the great answers and solutions! Works like a charm!
    1 point
  3. One start with this, will that be enough? (vl-load-com) (defun c:Retain_Wall ( / js AcDoc Space dlt ename obj pr dist_start dist_end pt_start pt_end alpha seg_len seg_bulge rad ang_vtx pt_cen pt_vtx pt_lst inc_ang tmp ang dir nw_cir l_int nw_pl) (princ "\nSelect the polyline.") (while (null (setq js (ssget "_+.:E:S" '( (0 . "*POLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 112) (-4 . "NOT>") ) ) ) ) (princ "\nSelect is empty, or isn't POLYLINE!") ) (setq AcDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Space (if (eq (getvar "CVPORT") 1) (vla-get-PaperSpace AcDoc) (vla-get-ModelSpace AcDoc) ) ) (vla-startundomark AcDoc) (initget 7) (setq dlt (* 0.5 (getdist "\nLength of segment?: ")) ename (ssname js 0) obj (vlax-ename->vla-object ename) pr -1 ) (repeat (fix (vlax-curve-getEndParam ename)) (setq dist_start (vlax-curve-GetDistAtParam ename (setq pr (1+ pr))) dist_end (vlax-curve-GetDistAtParam ename (1+ pr)) pt_start (vlax-curve-GetPointAtParam ename pr) pt_end (vlax-curve-GetPointAtParam ename (1+ pr)) alpha (angle pt_start pt_end) seg_len (- dist_end dist_start) seg_bulge (vla-GetBulge obj pr) ) (if (not (zerop seg_bulge)) (progn (setq rad (/ seg_len (* 4.0 (atan seg_bulge))) ang_vtx (+ (angle pt_start pt_end) (- (* pi 0.5) (* 2.0 (atan seg_bulge)))) pt_cen (polar pt_start ang_vtx rad) pt_vtx (polar pt_start (- ang_vtx (* pi 0.5)) dlt) pt_lst (cons pt_vtx (cons (polar pt_start (+ ang_vtx (* pi 0.5)) dlt) pt_lst)) inc_ang (if (< rad 0) (- (angle pt_cen pt_start) (angle pt_cen pt_vtx)) (+ (angle pt_cen pt_start) (angle pt_cen pt_vtx)) ) ) (repeat (fix (/ (abs (* 4.0 (atan seg_bulge))) (* 2 inc_ang))) (setq ang (if (< rad 0) (- (angle pt_cen pt_vtx) inc_ang) (+ (angle pt_cen pt_vtx) inc_ang) ) tmp (polar pt_cen ang (abs rad)) dir (angle pt_vtx tmp) ) (set 'pt_vtx tmp) (setq pt_vtx (polar pt_vtx dir dlt) pt_lst (cons pt_vtx pt_lst) ) ) (setq nw_cir (vlax-invoke Space 'AddCircle pt_vtx 20.0) l_int (vlax-invoke nw_cir 'IntersectWith obj acExtendThisEntity ) ) (entdel (entlast)) (setq nw_pl (vlax-invoke Space 'AddLightWeightPolyline (apply 'append (reverse (cons (list (car (cdddr l_int)) (cadr (cdddr l_int))) (mapcar '(lambda (x) (list (car x) (cadr x))) pt_lst ) ) ) ) ) ) (vlax-Put nw_pl 'Color 1) (vlax-Put nw_pl 'ConstantWidth 0.4) ) ) ) (prin1) )
    1 point
  4. Try this hopeful can follow prompts expects a Line Arc Line, NOT PLINE. Very much a 1st attempt, limited testing. Code removed for update
    1 point
  5. You can use ssget to select multiple objects and retrieve the object layer names, in a simple version it will execute the vplayer f for a layer multiple times if you pick objects on same layer. (defun c:vlf ( / x layname ss ) (prompt "\nPick entities on the layers you want freeze in this Viewport: ") (setq ss (ssget )) (setq x 0) (repeat (sslength ss) (setq layname (cdr (assoc 8 (entget (ssname ss x)))))) (command "_vplayer" "f" layname "" "") (princ) (setq x (+ x 1)) ) )
    1 point
  6. No apologies necessary Henry, I can certainly see the source of the misunderstanding. To clarify, I am aware of the mtp / m2p function, however, I will almost always opt to perform my own geometrical calculations within my programs over reliance on command modifiers, the geomcal utility, or any Express Tools. Of course as you know, the program could equally be written: (defun c:mm2p ( / ss ) (if (setq ss (ssget "_:L")) (command "_.move" ss "" "m2p" "\\" "m2p" "\\") ) (princ) ) Finally, I'm delighted that my posts have been of benefit to you. Cheers Steve, I guess sometimes the simple ones are the most useful.
    1 point
  7. Lee is more of a programmer than a day-to-day AutoCAD user. Most of us prefer it that way as his custom lisp routines have often saved us from ourselves and saved the day as well.
    1 point
×
×
  • Create New...