Search the Community
Showing results for tags 'pline'.
Found 15 results
Polyline between last and next first point
Tanookh Momin posted a topic in AutoLISP, Visual LISP & DCLHello everyone. I created this lisp with the help of chatgpt I need your help to complete this. I've attached a CAD file for your reference as what I'm looking for. I have some idea in my mind but I don't know how to execute that. 1. required distance between last and next 1st point (to creat red line- refer CAD file) 2. calculate the distance from next 1st point. (to extend the cyan line- refer CAD file) If you modify in my lisp, it will be really helpful me to learning. 2023-04-30 Test.lsp 2023-04-30.dwg
Mline to Pline
autolisper posted a topic in AutoLISP, Visual LISP & DCLHi All, I am trying to draw a pline by connecting all the vertices of the mline. Below is my code, but it gives an error saying; error: bad argument type: fixnump: (vl-load-com) (defun c:hl_mltopline () (setq mspace (vla-get-modelSpace (vla-get-activeDocument (vlax-get-acad-object) ) ) ) (setq ml (vlax-ename->vla-object (car (entsel "\nPick a multiline: ")) ) ) (setq coord (vlax-safearray->list (vlax-variant-value (vla-get-coordinates ml)))) (setq pl_points_safearray (vlax-make-safearray vlax-vbDouble pl_points_list)) (setq pline (vla-addlightweightpolyline mspace )) (entmod pline) ) Could someone please help me fix this? Thanks in advance..!!
3D Lines change to Pline
CafeJr posted a topic in AutoLISP, Visual LISP & DCLDear friends, how long I was here!... I need some help, if someone knows any lisp to convert Lines in 3D to 3D Polylines. The goal about it is to do a Pipeline tubes in 3D way. Thanks a lot for any help. CafeJr...
amitbhat212 posted a topic in The CUI, Hatches, Linetypes, Scripts & MacrosHi, I have just started using autocad two weeks ago and I'm trying to make my first script file, a joined, closed polyline that is a rectangle. The code is below: _pline -15000,0 15000,0 15000,-1000 -15000,-1000 c (there is a space after the 'c' and a return after the line) When I run, it creates a trapezoid and I'm not sure why (it is joined and closed). The first and second points are in the correct locations. The third point is not (it's at (15000,-1160.7425)) and the fourth point is not (it's at (-15200,-1160.7425)). All the angles from the XY plane are 0, so none of them are going into the z dimension. Also, the problem vanishes when I remove the negative signs from the y coordinates. Does anyone know what's going on and can provide a fix? Thanks!
Running Pline then executing a custom command in same lisp! Help!
tmelancon posted a topic in AutoLISP, Visual LISP & DCLI have written a little small command to run revision cloud on last object (i.e. rectangle, pline, circle...etc) and it works fine but I was trying to figure out a way to run that custom command after drawing my rectangle or pline. Instead of having to type the shortcut immediately after, every time. Here is custom rev cloud command I am referring to, this one works flawlessly when run as a standalone after I finish drawing said object that it will be used on but I would like to combine.. see below: (DEFUN C:RCL () (COMMAND "REVCLOUD" "O" "L" "") (COMMAND "-INSERT" "REV-TRI" PAUSE "" "" "") (COMMAND "EXPLODE" "L" "") (COMMAND "DDEDIT" "L" "") (PRINC)) Here is rectangle command with the attempt to run custom afterwards. It works but looks buggy and most likely written wrong. (take it easy ive been learning): (DEFUN C:RECL () (COMMAND "RECTANGLE" PAUSE PAUSE) (C:RCL) (PRINC)) Here is my attempt at the pline one but I dont even know where to start so it allows user unlimited points then hitting "c" for close afterwards AND THEN running the custom command: (DEFUN C:PLR () (command "_.PLINE") (coMmand pause) (C:RCL) (PRINC))
2015 for Mac - Pline will not show
ORgrown posted a topic in AutoCAD GeneralStrange issue; didn't see any other like it in the forum and similar found online didn't have any fixes that worked here. Colleague has AutoCAD 2015 for Mac OSX 10.8.5 (*I know, I know...WHY??) Trying to draw a Pline. We get the + sign when choosing starting point, then nothing as you stretch any direction, nothing when clicking a second point or multiple points or ending command. Tried to change width to 4 - same results. Tried the following settings: PLINETYPE set to 0 and 1 PLINEWID set to 0 and 1 Layer is ON and UNFROZEN. LINE command works. Same drawing does just fine on two Windows PCs using AutoCAD Map 5 and AutoCAD 2000. Hope someone can help. Thanks...
Way to change all Splines to Polylines automatically?
Precision posted a topic in AutoCAD 2D Drafting, Object Properties & InterfaceHi all, I'm familiar with the pedit command to turn a spline into a polyline, but I'm wondering if there's a way to change all Splines to Polylines automatically to save a hell of a lot of time. I've tried loading "Spline-to-Pline" LISP file, It's pretty shocking for keeping a reasonable tolerance and resolution at the same time as I need a line/arc length of at least .3mm for our CNC laser cutter.. Any thoughts? (See attached ACAD file with Splines I'm converting) Cave AUTOTRACE.dxf
Trim Pline with Global width in angular fashion
bababarghi posted a topic in AutoCAD 2D Drafting, Object Properties & InterfaceImagine the magenta vertical line is a poly-line with a preset global width assigned to it already. Is it possible to achieve what is depicted in following screenshots? From this: To this?
Make a loop return the result for each time its body is obeyed
dak posted a topic in AutoLISP, Visual LISP & DCLHi everyone, Just trying to pass a list of points to a "pline" command. The problem is num of points is initially unknown, though being calculated within a routine. The following code (as smth to start with) evolves known num of points. (defun c:pltest6 () (setq pts (list '(0 0) '(0 10) '(10 10) '(10 20) '(20 20) '(20 30) '(30 30))) (setq ptqty 7) (setq ptnum 0) (command "pline" (car pts) (pt_retr pts) (pt_retr pts) (pt_retr pts) (pt_retr pts) (pt_retr pts) (pt_retr pts) "" ) ) (defun pt_retr (lst) (setq ptnum (1+ ptnum)) (repeat ptnum (setq lst (cdr lst)) ) (setq pt (car lst)) ) Repeat/foreach don't do, 'cause they return the value of the last iteration.. Now my Q is, is it possible to modify the code above to use loop instead of repeat one and the same line (moreover, unknown number of times ), OR some other approach would rather fix the task? Thank you in advance, Dmitro
Poly lines in lisp
Erickson1026 posted a topic in AutoLISP, Visual LISP & DCLHello all, Somewhat new at using lisp for a very specific function. Here's the issue, I have a lisp routine that needs to save a layerstate, set a specif ic layer current, lock the others, then run the poly line command, exit the pline command, then reset back to the original layer state after running the pline command. Here's the code so far. The pline is erroring out before I get to the layer state which are still being developed. So main question, can I get the pline command to work properly first. LOA.LSP 2012 by David W. Erickson ;;; DESCRIPTION ;;; ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command. (DEFUN C:LOA (/ LAYER OFF ) (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "" ) (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. ")) (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "") (command "pline" pt1 pause ) (COMMAND "-LA" "A" "R" "DAVE" "" "" "" ) (COMMAND "-LA" "A" "D" "DAVE" "" "" "" ) (princ) ) Thanks in advance. Dave
filtering out identical plines from a list
jeremyearle5 posted a topic in AutoLISP, Visual LISP & DCLI'm trying to filter out plines that are duplicates of each other from a list. I've been trying to compare 1 point in the first pline against the list of points from the other plines. They will only share a point if they are identical for this use. I've been trying to work this out on my own but it has becaome a complete mess and I know there must be a simpler way. This code works but has no way of checking the last pline. comparepts is a list of lists of the points on the plines nubpaths is a list of the pline entity names Help if you can please. (setq compctr1 0 ctr 0 numnubs (length nubpaths) nlist (list) ) (while (< compctr1 (- numnubs 1)) (setq compctr2 (+ compctr1 1)) (while (and (< compctr2 numnubs) (not reject)) (setq complngth (length (nth compctr2 comparepts))) (setq compctr3 0) (while (and (< compctr3 complngth) (not (equal (car (nth compctr1 comparepts)) (nth compctr3 (nth compctr2 comparepts)) 0.00009))) (setq compctr3 (+ compctr3 1)) ) ;_ end of while (if (/= compctr3 complngth) (setq reject T) ) ;_ end of if (setq compctr2 (+ compctr2 1)) (if (= compctr2 numnubs) (setq nlist (append nlist (list (nth compctr1 nubpaths)))) ) ) ;_ end of while (setq compctr1 (+ compctr1 1) reject nil ) ) ;_ end of while
How to get start and end point of a single line pline
jeremyearle5 posted a topic in AutoLISP, Visual LISP & DCLI need to know how to get the start and end points of a polyline. I'm a rookie at this and just learned how to pull out the start and endpoints of a line and when I went to do it to a polyline I was completely lost. Another question: I use a comand that takes a line and turns it into a perforated line with each segment being a separate poly line. It creates them all in order down the line. Immediately following this command, would there be a way to call the first poly line created to extract its data, without manually selecting it?
points at vertixes and inbetween???
r4n posted a topic in AutoLISP, Visual LISP & DCLhowdy, I found this code: (defun c:ppav () (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0) (repeat (/ (length c) 2) (setq x (nth i c) y (nth (1+ i) c)) (vla-addpoint *model-space* (vlax-3d-point (list x y 0.0))) (setq i (+ i 2)) (setq temp (osnap (list x y) "mid")) ; I added this (command "point" temp) ; and this ) (princ) ) and added the two lines to try and get points set on the midpoints of the pline segments....but it does not work as intended. Some midpoints are set on the wrong segment and 1 extra point is being set. Can Anyone Help? thanks Ray
Add block to endpoint and align with the pline
rouho posted a topic in AutoLISP, Visual LISP & DCLHello, I am looking for a lisp that would add a block (ex. arrow) to the each endpoint of a pline and align it with that pline. Any ideas? Thank you in advance.
Drawing a PLINE and getting it's area - LISP
linuxap posted a topic in AutoLISP, Visual LISP & DCLHi everyone! I'm kinda new in this LISP world and I'm having some trouble on this project of mine. Here we go: I need a LISP to draw a PLINE and create a text with the PLINE's area. The area is always different and I don't have the points to draw the PLINE, so I have to draw it with the mouse and when I finish I want to have the area value in a text placed inside that PLINE (I can place it with a mouse click, but I don't want to have to write the area). This is the code I already wrote: I would appreciate any help! Thanks!