autolisp

Scaling lengths in an AutoCAD diagram

人走茶凉 提交于 2021-02-11 12:08:36
问题 This is a followup to my previous post here I've a 2D geometry created using the following code, ref. (defun graph ( pts sls tls ) ( (lambda ( l ) (foreach x l (text (cdr x) (itoa (car x)) 0.0 1)) (mapcar '(lambda ( a b / p q r ) (setq p (cdr (assoc a l)) q (cdr (assoc b l)) r (angle p q) ) (entmake (list '(0 . "LINE") (cons 10 p) (cons 11 q) '(62 . 8))) (text (mapcar '(lambda ( x y ) (/ (+ x y) 2.0)) p q) (rtos (distance p q) 2) (if (and (< (* pi 0.5) r) (<= r (* pi 1.5))) (+ r pi) r) 2 ) )

AutoLisp trying to select LWPolyline BUT ONLY RECTANGLES. How do I do that?

时光怂恿深爱的人放手 提交于 2021-01-29 15:50:25
问题 So I'm trying to select all entities that are rectangles. I tried this (setq ss (ssget "X" '((0 . "RECTANG")))) , but it seems to select all polylines, including polygons. I tried with checking the vertices = 4 but then it also selects diamonds. How could I implement such a code? 回答1: I'd be highly surprised if your current code using the ssget filter list '((0 . "RECTANG")) was to select anything at all, as RECTANG is not a valid entity type for DXF group 0. In AutoCAD, the standard RECTANG

Batch run autoLISP with Python

佐手、 提交于 2020-04-16 05:30:12
问题 I want to run an autoLISP on multiple CAD files (e.g. all files in a folder). Basically, open file (DWG), run LISP (including, save file) and close. I'm new to LISP, but less new to Python. Is it possible to run the batch with Python? I know how to open a file with a program in Python, but not how to run the LISP. Alternatively, anybody know how to run the batch with LISP? The solutions I've found so far involve third party software and C#. Also, I'm running AutoCAD-MEP 2018 and Python 3.5.

How to update xdata information of an entity when it is copied

一笑奈何 提交于 2020-01-16 10:43:58
问题 I have two texts associated to a line. Because the texts represent some data of the line they are always considered children of the line and visible next to it. Through some lisp routines, if the data of the line change, the text entities reflect the change by changing their text. For that I have stored the handle of the line to each text as xdata and vice versa, e.g. the handles of the texts into the line. The problem arises when I copy the line with the texts where each one gets a new

How to update xdata information of an entity when it is copied

你说的曾经没有我的故事 提交于 2020-01-16 10:43:48
问题 I have two texts associated to a line. Because the texts represent some data of the line they are always considered children of the line and visible next to it. Through some lisp routines, if the data of the line change, the text entities reflect the change by changing their text. For that I have stored the handle of the line to each text as xdata and vice versa, e.g. the handles of the texts into the line. The problem arises when I copy the line with the texts where each one gets a new

How to update xdata information of an entity when it is copied

北城余情 提交于 2020-01-16 10:43:33
问题 I have two texts associated to a line. Because the texts represent some data of the line they are always considered children of the line and visible next to it. Through some lisp routines, if the data of the line change, the text entities reflect the change by changing their text. For that I have stored the handle of the line to each text as xdata and vice versa, e.g. the handles of the texts into the line. The problem arises when I copy the line with the texts where each one gets a new

Autocad 2018 autoload dll

*爱你&永不变心* 提交于 2019-12-24 07:19:06
问题 I am trying to automatically load dll files to Autocad 2018. How can i achieve that? I want to automate so it can do it on startup. With netload everything works. I have used *.lsp ways. Can someone please help? I have found plenty online of ways but none work. 回答1: AutoCAD's official way to load .dll files written in .Net on startup is to use autoloader feature. You basically bundle the .dll with any other files you want into a default folder where AutoCAD reads at startup to load all plug

What is the order of load AutoCAD plugins?

我的梦境 提交于 2019-12-19 04:04:35
问题 There are few ways of automatic load applications - plugins when AutoCAD starts. I know those: startup suite - attached by GUI List item %appdata%....\support\zwcad2018.lsp ( I use ZWCAD, maybe in Acad, there is another path. The long time ago when I worked on Acad it was acad.lsp, but that was times before Windows UAC feature). *.mnl loaded while corresponding *.mnu is loaded ( old fashion way, but is ZWCAD possible) what about Acad? On-demand loading: HKEY_CURRENT_USER\Software\ZWSOFT\ZWCAD

drawing line close to polyline

瘦欲@ 提交于 2019-12-11 04:05:52
问题 I have a Triangle as a polyline and I want to draw an Altitude. I give the command "line" or "_line" the right points but AutoCAD draws the line from the vertex to the adjacent vertex. It's not just in AutoLISP, AutoCAD won't let me draw a line from a vertex to the middle of an edge in a polyline. How can I do that? I thought of adding a vertex in the polyline, but this didn't help that much. I tried to add connector: a circle or another object close enough to the line and connect the

Visual Lisp: how to call functions in external C++ DLL

孤街浪徒 提交于 2019-11-30 04:12:33
问题 I have a C++ dll I have written (native, not .net), and I would like to use its functionality from Visual Lisp. Can anyone point me to an example of how to do this, or at least which bit of documentation to read? 回答1: I solved this by writing an activex/COM wrapper for my dll, which I think should make it easier to link to in future. Starting a thread on the swamp yielded some answers from nice people about how to call COM from Visual Lisp. For the record, it looks something like this: //in c