All Activity
- Past hour
-
Moving objects within polyline to different layer
aridzv replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
@Hsanon the only way I can reproduse what you show is if "exist" layer dosen't exist. I don't see that layer in the video you shared. MAKE THIS LAYER BEFORE RUNNING THE LISP AS SHOWN IN MY VIDEO. -
Moving objects within polyline to different layer
Hsanon replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
And its not happening on my machine......am i doing anything wrong ???? is it an autocad issue ??? attaching a screen recording... sorry to be such a bother !!!!! changing layers.mp4 - Today
-
hitechcreator joined the community
-
Multiple polyline viewport from model to layout
iztok14 replied to iztok14's topic in AutoLISP, Visual LISP & DCL
Sorry fot late answer, i was away for weekend. I tried "rec2lays" lisp but doesnt work for me ? noting hapend when i type command "rec2lays". Yes i d like to have vieports in only one layout side by side ? The scale is 1:1 model layout. thy, Iztok -
Moving objects within polyline to different layer
aridzv replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
@Hsanon I tried both lisps and they work. @BIGAL lisp works - after you run the command you need to select the boundery polygon. with my lisp - before runnig it you need to make sure both "exist" and "site" layers exist. in your case you need to create "exist" layer. See attached Video using my lisp. Recording 2025-11-10 110909.mp4 -
Moving objects within polyline to different layer
Hsanon replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
Hi, many thanks for your help Aridzv and BigAl, But, all entities are being converted to layer "site". The ones inside the pline are not being moved to layer "exist" I'm attaching the drawing on which I am testing. surveytest.dwg -
Bahour joined the community
-
"Plines in same direction", Yes Lee-Mac has a method also. Note the use of Pedit as Bricscad does not have a "Reverse" command, as at V25. ; Checking if pline is CW or CCW and set to CCW ; Orignal idea by Kent Cooper, 1 August 2018 Offsetinorout.lsp ; By Alan H July 2020 (defun AH:chkcwccw (ent / objnew area1 area2 obj minpoint maxpoint) (setq obj (vlax-ename->vla-object ent)) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (setq dist (/ (distance pointmin pointmax) 20.0)) (vla-offset obj dist) (setq objnew (vlax-ename->vla-object (entlast))) (setq area1 (vlax-get objnew 'Area)) (vla-delete objnew) (vla-offset obj (- dist)) (setq objnew (vlax-ename->vla-object (entlast))) (setq area2 (vlax-get objnew 'Area)) (vla-delete objnew) (if (> area1 area2) (command "Pedit" ent "R" "") ) (princ) ) (defun c:CWCCW ( / *error* x ent oldsnap doc ss) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (prompt (strcat "\nSelect Plines to check")) (if (setq ss (ssget '((0 . "*POLYLINE")))) (progn (repeat (setq x (sslength ss)) (setq ent (ssname ss (setq x (- x 1)))) (AH:chkcwccw ent) ) ) ) (vla-endundomark doc) (alert (strcat (rtos y 2 0) " Plines reversed")) (setvar 'osmode oldsnap) (princ) ) (vl-load-com) (prompt "\nType CWCCW to set plines to CCW") (c:CWCCW)
-
tranbao17 joined the community
- Yesterday
-
Craig Rathke started following Curb offset
-
Craig Rathke joined the community
-
@BIGAL You lisp works very well, but I spend alot of time having to delete offsets if I'm not sure where the true start of line is....especially with close polylines. It will always seems to offset the wrong direction and I end up having to reverse the original closed polyline. (FYI I am trying to use a slightly altered version of your code, using a -0.5' offset for the back of curb since I want to offset to both sides based on the initially drawn face of curb for parking lots.) Is there any way the code can be altered in this way: Instead of selecting the beginning point of the object, you just select the object normally, then it prompts you to select the side of the back of curb (in your code, that would be the off1) and then I get an offset to both sides of the selected line..a BOC (off1) and an EOP (off2). This adds an extra click but makes sure I offset the correct direction. I'm not sure how to begin to do this. Any help would be appreciated. Thanks!!! -Craig
-
I’m sorry. I didn’t think this was important — but maybe I was wrong. I usually copy drawings from my PC to edit them on my smartphone. The app I use on my smartphone is DWG FastView. I don’t remember where I sent it from, but if that message appeared when opening it, it must be because I saved the drawing on my smartphone for some reason and sent it from there.
-
I think Lee Mac had something to work out polyline direction, so should be able to check and reverse a polyline if necessary. Reverse back again after
-
From what I have gathered, no easy task to do this, many GIS programs seem to struggle with pinpoint accuracy as well. The method for QGIS, is involved, so I didn't get time to run through it with the plugin, but I did dig into reddit and some GIS sites. Basically they do similar method, they just add a lot of points down the "polyline/line" and run the appropriate "centerline tool". Where someone posted results, I saw some in some of them the same "off center through some areas" as in the methods posted here. This was apparently plenty good enough for most GIS users, though I only did a relatively quick dig. In a similar method for AutoCAD, maybe adding more points to the polylines would help. I might have time Monday at home to check QGIS. Though I did import the OPs drawings into a session, the first one comes in very strange, the second seemed to be correct. The OP still hasn't answered why the second .dwg posted comes up as not an AutoCAD drawing. For AutoCAD, it helps if BOTH polylines go the same direction.
-
Mel73 joined the community
-
Moving objects within polyline to different layer
BIGAL replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
My $0.05 does not check for off or frozen layers. (defun c:wow ( / ent co-ord ss) (if (tblsearch "layer" "Site") (princ) (command "-layer" "Make" "Site" "c" 1 "" "") ) (if (tblsearch "layer" "Exist") (princ) (command "-layer" "Make" "Exist" "c" 2 "" "") ) (command "chprop" "all" "" "la" "Site" "") (setq ent (car (entsel "\nPick the pline "))) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))) (setq ss (ssget "WP" Co-ord)) (command "chprop" ss "" "LA" "Exist" "") (princ) ) (c:wow) - Last week
-
I Created a closed polyline and offsetting in. the smaller the offset the more "detail" (points) you get but you need them to get the right vertex or you just cutting corners. I don't really know how to pick up those points and don't really want to offset 1cm and have a million points either. CPL offset.dxf
-
Moving objects within polyline to different layer
aridzv replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
see new code. make sure the layers names are correct. (defun c:chglyobjpl (/ acdoc p_list p_coord sset ent obj newLayerName newLayerName1 i) (vl-load-com) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (princ "\nSelect All Objects To Proccess") (setq ssall (ssget)) (setq p_list (entget (car (entsel "\nSelect the Polyline Boundery For ''exist'' Layer: ")))) (setq i 0) ;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects To site Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if ssall (progn (sssetfirst nil nil) (setq newLayerName1 "site");;(getstring T "\nEnter new layer name: ")) (repeat (setq i (sslength ssall)) (setq i (1- i)) (setq ent (ssname ssall i)) (setq obj (vlax-ename->vla-object ent)) (vla-put-Layer obj newLayerName1) );;repeat (vla-Regen acdoc acAllViewports) (sssetfirst nil nil) );;progn (princ "\nNo objects found in the drawing.") );;if ;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects To site Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq ent nil) (setq obj nil) (setq i 0) ;;;;;;;;;;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selection-set-using-existing-polygon/td-p/11307274 ;;;;;;;;;;;calderg1000 msg-7 (if (setq p_coord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) p_list) );;end setq p_coord );;end if condition (sssetfirst nil (setq sset (ssget "_wp" p_coord))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Select Objects In polygon;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if sset (progn (sssetfirst nil nil) (setq newLayerName "exist");;(getstring T "\nEnter new layer name: ")) (repeat (setq i (sslength sset)) (setq i (1- i)) (setq ent (ssname sset i)) (setq obj (vlax-ename->vla-object ent)) (vla-put-Layer obj newLayerName) );;repeat (vla-Regen acdoc acAllViewports) (sssetfirst nil nil) );;progn (princ "\nNo objects found in the drawing.") );;if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects To exist Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (sssetfirst nil nil) (princ) );;end defun test1.mp4 -
Moving objects within polyline to different layer
Hsanon replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
Thanks ... but..... on running the program, its saying that "no objects found in the drawing" and the program closes -
antabur joined the community
-
Destiny07 joined the community
-
Lisp routine for trimming everything outside a closed polyline?
Destiny07 replied to EIA's topic in AutoLISP, Visual LISP & DCL
I used the lisp called cookie cutter .. it worked like magic thank you SLW210 -
Moving objects within polyline to different layer
aridzv replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
Try this: (defun c:chglyobjpl (/ acdoc p_list p_coord sset ent obj newLayerName i) (vl-load-com) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) ;;;;;;;;;;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selection-set-using-existing-polygon/td-p/11307274 ;;;;;;;;;;;calderg1000 msg-7 (setq p_list (entget (car (entsel "\nSelect the LwPolyline: ")))) (if (setq p_coord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) p_list) );;end setq p_coord );;end if condition (sssetfirst nil (setq sset (ssget "_wp" p_coord))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Select Objects In polygon;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if sset (progn (setq newLayerName "exist") ;;(getstring T "\nEnter new layer name: ")) (repeat (setq i (sslength sset)) (setq i (1- i)) (setq ent (ssname sset i)) (setq obj (vlax-ename->vla-object ent)) (vla-put-Layer obj newLayerName) );;repeat (vla-Regen acdoc acAllViewports) (sssetfirst nil nil) );;progn (princ "\nNo objects found in the drawing.") );;if ;;;;;;;;;;;;;;;;;;;;;;;;;;;;Change Objects Layer;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (princ) );;end defun -
Steven P started following Moving objects within polyline to different layer
-
Moving objects within polyline to different layer
Steven P replied to Hsanon's topic in AutoLISP, Visual LISP & DCL
If you want to have a go, look at Selection Sets to select everything within the polyline (see Lee Mac Selection sets page - it is rather good - ssget), window polygon or crossing polygon Do 2 selection sets - one for everything "_X" and one for Crossing Polygon, I think Lee Mac has a routine there to remove one selection set from another. This gives you 2 sets of entities to work with Loads of LISPs out there to change layers. Have a go, it is easier than you might think -
Hsanon started following Moving objects within polyline to different layer
-
Moving objects within polyline to different layer
Hsanon posted a topic in AutoLISP, Visual LISP & DCL
Hi, Is there a Lisp routine which can move all objects within a selected polyline to a layer called "exist" and all objects outside that same polyline to a layer called "site" ?? ignoring all frozen or OFF layers ?? Regards. -
Multiple polyline viewport from model to layout
BIGAL replied to iztok14's topic in AutoLISP, Visual LISP & DCL
This is very much proof of concept, and needs some extra work but you can try it. I just did 162 layouts by selection did not try all 300+. You must use this new dwg as it has Layout1 set up correctly. I removed layout2 not needed. Obvious bug is if rectangs are not made in correct label sequence but can fix that if it happens. It uses creation order at moment. You should use 1 size for all the rectangs. ; https://www.cadtutor.net/forum/topic/98809-multiple-polyline-viewport-from-model-to-layout/ ; rectangs to layouts by AlanH ; Nov 2025 (defun rec2lays ( / ss ent txt ins pt2 pts ent2 co-ord mp ) (setvar 'ctab "Model") (setq ss (ssget (list (cons 0 "*TEXT") (cons 8 "SHEMA_NAME")(cons 410 "Model")))) (repeat (setq x (sslength ss)) (setq ent (entget (ssname ss (setq x (1- x))))) (setq txt (cdr (assoc 1 ent))) (setq ins (cdr (assoc 10 ent))) (setq pt2 (polar ins 5.4977 2.5)) (setq pts (list ins pt2)) (setq ent2 (ssname (ssget "F" pts (list (cons 0 "LWPOLYLINE")(cons 8 "SHEMA_RECT"))) 0)) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent2)))) (setq mp (mapcar '* (mapcar '+ (car co-ord) (caddr co-ord)) '(0.5 0.5))) (command "layout" "C" "Layout1" txt) (setvar 'ctab txt) (command "Mspace") (command "zoom" "c" mp 10) (command "zoom" "15XP") ; a custom scale of 15 seems to suit (command "Pspace") (setvar 'ctab "Model") ) (princ) ) sheme_JAS.dwg -
i need help in this piece, i need to Create the necessary views. Dimension the part and distribute the dimensions across the drawn views, Create a section cut in the indicated area so you don't have to dimension this radius as a hidden line (use whiche
ReMark replied to Manuel Marroquín's topic in Student Project Questions
So... what you need to create is a top, front and side view as well as a sectional view in 2D. Have you done anything like that in the past? -
Multiple polyline viewport from model to layout
BIGAL replied to iztok14's topic in AutoLISP, Visual LISP & DCL
As suggested can be done you would look for the "Mx" value then find the co-ords of the rectang, make a layout and create a viewport. You need to provide a couple of things, it would be best to have 1 true size title block in say "Layout1" this would be copied repeatedly. If you dont use a title block ignore. Part 2 as already requested you need to set one size for the layouts. Say a A4 etc. The rectangs are different sizes you need to set the size to match the biggest rectang say M15 as example then a proper scale can be used for the viewport. The layouts are then consistent. So get something like this at a fixed scale. -
Thanks, though it can be improved a bit too - I reckon the point of intersections would be better off on the lines between height points - tried that just now but got myhead going round in circles with a part of it. Will see what I can do for later
-
@Steven P that works way better than i dreamed... even if you say its a bit dirty... Being able to select the intersection of datum and reference line, and the scaling option is brilliant.. If i had a box of Jaffa Cakes they would be in your hands right now.... Thank you soo much.... @BIGAL thank you for the reply and i think i understand what you mean... but i need to leave some work for my understudy to do can't speed him up too much.....
-
Yes. My "one/cross-eyed" son has quite a few limitations: he only sees reality from one point of view. But reality is best analyzed in "Stereo." For the same reason, I think we need to analyze both polylines in the same way and at the same time (using angle bisectors). I hope to have time to make progress on my "good approach" next weekend. Someone has "travelled very far" in experimenting with this type of calculation: @marko_ribar I think it would be very interesting to hear his opinion on this.
-
Saxlle started following Multiple polyline viewport from model to layout
-
Multiple polyline viewport from model to layout
Saxlle replied to iztok14's topic in AutoLISP, Visual LISP & DCL
Do you have a desired layout format (paper size), desired scale, etc. or you just want to display of each viewport from model space no matter the scale, paper size, etc.?
