All Activity
- Today
-
BricsCAD reports the correct number of view-ports without requiring looping through the layouts first.
-
Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
SLW210 replied to Sathar's topic in AutoLISP, Visual LISP & DCL
As well as spend time making full instructions and even some videos of them in action. -
[Free LISP] Auto-mark revision clouds for design changes — compare two regions in same DWG
mohdomar replied to Beastt1992's topic in AutoLISP, Visual LISP & DCL
Thank you -
Aluminum composite panels parametric templates
indiancad replied to emosms's topic in AutoCAD 2D Drafting, Object Properties & Interface
I would avoid setting each flange. Begin with the panel dimensions then add horizontal, vertical, parallel and 45‑degree constraints only where the shape needs them. Measure each flange length on its own if the lengths can change. Look at the remaining degrees of freedom before adding another restriction because a missing restriction may control rotation or skew of length. Which CAD software are you using? -
Aluminum composite panels parametric templates
emosms replied to emosms's topic in AutoCAD 2D Drafting, Object Properties & Interface
It is a small production work, no BOQ needed. The "work order" comes as hand sketches, all sizes for the aluminum panels facade are taken on site. The panel's dwg go straight to cam software for nesting and CNC router output (the green line is perimeter cutting, beter to be closed polyline). Made something like "parametric blocks", the adjustable dimensions appear as properties and could be set directly there (image and dwg attached). One extra step could be - when there is just one side flange, the V groove (the blue line) overlaps with the perimeter cutting - this is extra milling time and not needed. Set it as flange2 = 0 (Left, Right, Bottom, Top). But as far as I get it I cannot make expression: (if flange2 = 0 -> the blue line to be hidden), so some manual cleanup is needed. Then if flange2 is 0 the sketch might get buggy and not accept another dimension properly, so have to start over with fresh block or try to pull the dimension handles. Parametric sketches work outside of a block - wrapping them into block is handy to set the dimensions as custom properties. The constraint order is rougly: - make all coincident points to rig the green (cutting) to the blue (V groove) - delete ALL other constraints. Autoconstraint DOES NOT take into account what you set in 'constraintsettings' and the other constraints might overconstrain what u want to achieve. - set fixed constraint (lower left corner) - set lower left lines: along X - horizontal, along Y - vertical - set colinear all vertical/ horizontal lines that are to be colinear. - set the first colinear line parallel to the allready set horizontal/ vertical, these could be chain set (left to right, bottom to top) - set the mitre angles locked at 45 (all of them) - apply parametric dimensions (base dimensions, flanges in order inside out) Setting parallel makes irregular (slightly trapezoid and slanted) panels imposible. But a template for this IS near impossible. The proper 90 angles could be anywhere, so better manually explode and adjust with strech command> Slanted/ irregular panels come usually as end rows/ columns of the mounting work, following the construction - it is all cast in situ concrete and (kind of sloppy) masonry in between. The block work: - select all and make block, set basepoint matching with the fixed constraint. - convert parametric dimensions to dynamic ones (inside block editor/ block edit tab/ tool for this) - rename the dimensions to something usefull (in the object properties panel) - set order/ priority in the 'parameters' dialog, so that the custom properties appear in an uniform order. PARAMETRIC.dwg -
FYI: my (67 . 1) filters out model space vports so only paper space vports will be selected.
-
I assuming "<>" and "/n" filter produce the same result as they both mean "not equal" (assuming lisp supports both syntax) Filter 410 . "~Model" may depend whether you have model space view ports or not. If you omit it and have no view ports in model space then the result should be the same. Regarding the codes I don't believe they are consistent, I did notice if its off screen we get -1 but not always but I haven't done enough testing to come to a conclusion. Looping through the layouts is the only thing I found that makes the codes predictable. I may test in BricsCad the morning to see how it behaves (if it supports the code as is).
- Yesterday
-
Just a comment using Bricscad only finds. D05 (sslength (ssget "_X" '((0 . "VIEWPORT") (67 . 1) (-4 . "/=") (69 . 1)))) returns 4 D03 = 4 D05 (sslength (setq ss (ssget "_X" (list (cons 0 "VIEWPORT") (cons 410 (getvar 'ctab)))))) returns 1 ie no normal viewports D03 = 2 a pspace and 1 viewport The order of SS is Viewport...Viewport Pspace may be different in Acad. I copied viewports for testing. Then erased one by one using (ssname ss X) can not erase pspace of course.
-
Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
BIGAL replied to Sathar's topic in AutoLISP, Visual LISP & DCL
Post a description about what they do something like this. Then people may get interested. Lisp files DEC 2025.docx -
@ronjonp When I first open the sample TrueViewports.dwg I shared in a previous post which defaults to Layout2 and I run (length (rjp-getvports)) I get 7. Even after initializing by clicking on Layout1. I still get 7. But after clicking on Layout2 when I run @DavidP code I get 6: (sslength(setq ss (ssget "_X" '((0 . "VIEWPORT") (-4 . "<>") (69 . 1) (410 . "~Model"))))) Likewise when I run my code I posted earlier I also get 6: (sslength (ssget "_X" '((0 . "VIEWPORT") (67 . 1) (-4 . "/=") (69 . 1)))) I think mine & @DavidP code is similar. But what I don't see is whether @DavidP code is filtering out something more than compared to mine.
-
Another tip if your setting multiple variables. You can handle them with 4 lines of code. (defun C:lnze (/ lyt) ;(setq oldEcho (getvar "CMDECHO") ; oldNOMUTT (getvar "NOMUTT") ; lyt (getvar "CTAB") ;) (setq vars '(cmdecho nomutt ctab) ;list of variables as many as you want. vals (mapcar 'getvar vars) ;store old values to a list ) ;(setvar 'CMDECHO 0) ;(setvar 'NOMUTT 1) (mapcar 'setvar vars '(0 1)) ;this sets cmdecho 0 and nomutt 1, stops at short list so ctab isn't changed. (vl-catch-all-apply '(lambda () (foreach lay (layoutlist) (setvar 'CTAB lay) (setvar 'CVPORT 1) (vl-cmdf "_.ZOOM" "_E") ) ) ) ;(setvar "CTAB" lyt) ;(setvar "CMDECHO" oldEcho) ;(setvar "NOMUTT" oldNOMUTT) (mapcar 'setvar vars vals) ;restore old values (princ) )
-
ronjonp started following Selecting viewport in a lisp
-
Side topic but I've found that this: (setq ss (ssget "_X" '((0 . "VIEWPORT") (-4 . "!=") (69 . 1)))) Does not work with layouts that are not initialized. CAB at TheSwamp put this together many moons ago and it's been solid ( don't remember what the function was originally named ) (defun rjp-getvports (/ a b c lst ss) (if (setq ss (ssget "_X" '((0 . "VIEWPORT")))) (progn (foreach e (mapcar 'cadr (ssnamex ss)) ;;Paper space block (if (and (setq a (cdr (assoc 330 (entget e)))) ;;Layout (setq b (cdr (assoc 340 (entget a)))) ;;Viewport not wanted (setq c (cdr (assoc 331 (entget b)))) ) (or (equal c e) (setq lst (cons (list e (cdr (assoc 71 (entget b)))) lst))) ) ) ) ) ;;Sort the list by taborder L 2 R (mapcar 'car (vl-sort lst (function (lambda (x y) (< (cadr x) (cadr y)))))) )
-
Thanks ZA appears to work fine. LOL I hear you... We often hear complains from clients that drawing is broken and we usually we can narrow it down to a few things...useer define ucs is set, UCSfollow set to 1 or garbage has been left both in PS or MS an zoom extent result to just dots on the scree. So I too run the zoom E in PS as well just to see if there any garbage outside the TB. FYI does work either: (vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports) doesn't update them. I added some prompt suppression... (defun DP:llnze (/ lyt) (setq oldEcho (getvar "CMDECHO") oldNOMUTT (getvar "NOMUTT") lyt (getvar "CTAB") ) (setvar "CMDECHO" 0) (setvar "NOMUTT" 1) (vl-catch-all-apply '(lambda () (foreach lay (layoutlist) (setvar "CTAB" lay) (setvar "CVPORT" 1) (vl-cmdf "_.ZOOM" "_E") ) ) ) (setvar "CTAB" lyt) (setvar "CMDECHO" oldEcho) (setvar "NOMUTT" oldNOMUTT) (princ) ) now Using this works fine.: (setq ss (ssget "_X" '((0 . "VIEWPORT") (-4 . "<>") (69 . 1) (410 . "~Model")))) So for this is working great
-
Alex Brikulsky joined the community
-
I made ZA because a coworker would leave things zoomed in. Might just need to hit it with (vl-load-com) (vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports) to fix the 0,0 problem.
-
My other option would be to ensure the view port sits in specific layer. The danger with that is I depend on the user to create the VP correctly. @mhupp thanks for the zoom ext all tabs. Good looks like (vl-cmdf "_.Zoom" "E") behaves similar to "command-s" as we need to ensure AutoCAD updates every system variable before moving to the selection set. FYI: lee-mac's vpoutline routine has the same problem as it draws the PS extra view ports near 0,0. Adding calling C:ZA in Lees routine fix the issue it that. The idea is to use them to generate selection polygons in MS. Basically Lee's routine is accomplishing that minus the filtered for the actual view ports.
-
Yancy2 joined the community
-
Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
SLW210 replied to Sathar's topic in AutoLISP, Visual LISP & DCL
Like @Danielm103, I was also going to suggest Autodesk Store and/or what @BIGAL stated would be my choices. It really depends on what you are comfortable/familiar with. Personally, unless your LISPs are really making difficult and/or complicated work easy and a lot faster, I wouldn't believe they would be big sellers since they seem targeted at AutoCAD MEP, I haven't looked at any numbers lately, but a lot of those users are slowly rolling over to Revit, I was using AutoCAD MEP occasionally, but haven't had any of that type work to do in a good while, perhaps an occasional user such as myself would be a potential customer, I am not sure what percentage of AutoCAD users "do a little of everything" like I do. That is not meant to deter you, just to give an insight on what $$$ and effort you need to spend getting them secure and keeping them up. What future plans do you have on providing support? I see a lot of for purchase apps that end up having the publisher lose interest or other issues and the support goes away. -
Maybe read through this thread. Get All Viewports in All Layouts - Autodesk Community What exactly are you trying to accomplish after getting them selected?
-
Danielm103 started following Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
-
Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
Danielm103 replied to Sathar's topic in AutoLISP, Visual LISP & DCL
I have a couple apps on the autodesk store. here's one XLSX field evaluator. https://apps.autodesk.com/ACD/en/Detail/HelpDoc?appId=4867035866745163447&appLang=en&os=Win64 Anyway, I use Autodesk's entitlement API. All you need to do is register your application , they give you an Application id. you can see the ID in the link all you need to do is query the server with the ONLINEUSERID. You need to be able to let the user use your application offline, my app checks at the beginning of each month here's a quick lisp sample (defun c:IsEntitled (/ http response) (setq appId (getstring "Enter AppId ")) (setq userId (getvar "ONLINEUSERID")) (setq url (strcat "https://apps.autodesk.com/webservices/checkentitlement?userid=" userId "&appid=" appId ) ) ;https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms759148(v=vs.85) (if (setq http (vlax-create-object "MSXML2.XMLHTTP")) (progn (vlax-invoke-method http 'open "get" url :vlax-false) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list http 'send))) ) (setq response (vlax-get http 'responseText)) ) (vlax-release-object http) ) ) (cond ((> (vl-string-search "true" response) 0) (princ "\nTrue")) (t (princ "\nFalse")) ) (princ) );def -
Mourou joined the community
-
Think the 0 thing is for rendering but not 100% on that. for (68 . -1) means the viewport is off screen also for rending. This zoom ext all tabs and returns to the one you were on. ;;----------------------------------------------------------------------------;; ;; Zoom Extents All Tabs (defun C:ZA (/ lyt) (setq lyt (getvar 'ctab)) (foreach lay (layoutlist) (setvar 'ctab lay) (setvar 'cvport 1) (vl-cmdf "_.Zoom" "E") ) (setvar 'ctab lyt) ) @Paul Li I'm just posting the ssget not full code. Might also want to check this out. https://www.lee-mac.com/vpoutline.html
-
@mhupp I think @DavidP wants to filter out those viewports that are not "true view ports" which means when objects are used as view ports. As a test I run his c:COLLECTLAYOUTVIEWPORTS lisp code on the attach drawing the return value is 3: But when I run your lisp code on the same drawing the return value is 6: TrueViewports.dwg
-
Yeah @Paul Li had to look at my notes when I got home. My updated code above should give David what they are looking for in one ssget. kept the 410 just to be safe but used ~ to ignore instead of (-4
- Last week
-
Best Way to Protect Commercial AutoLISP Applications – High-Level Security and Licensing
BIGAL replied to Sathar's topic in AutoLISP, Visual LISP & DCL
Like the idea of using a cloud address that is yours. There is mentions in some forums of un-encrypting but how many really no how to do that. Yes people do give your code to friends, for me had security so eventually worked out the code was given to some one else. So no install. Some methods all lisp based. USB IP address on pc network card etc Hard disk ID Username CAD serial number Read registry Read a file from a web server. Some internet providers allow you space on their site at no cost. Re updating there is an old DOS command "Copy File1+file2 file3". so file1 is a lisp file with the correct security code checks, file2 is your normal lisp program code without security. You would compile file3. Pretty easy to make a BAT file for the task, did use this method very extensively. Do around 50 lisps in one go. One grey area is I do custom lisps for clients so who owns the code ? Unless you have some form of right to use contract. They are provided with source code. Last comment I have a Install.lsp that does all the hard work, unzips a file to correct directory with all the code dwg mnu cuix etc, adds support paths and new menu's, toolbars etc, Can do as a Bundle if needed. just ask if want more detail, saves making a MSI or EXE etc. -
Just a comment Bricscad sometimes does not support the "(( make a list method. so this does work and I added get for current layout, in case have multi viewports in a layout. You could loop through the layouts rather than getting all. If make a list of properties then have the layout name. Having problems post in <> get error message finally got it. A test (sslength (setq ss (ssget "_X" (list (cons 0 "VIEWPORT") (cons 67 1) (cons -4 "/=") (cons 69 1)(cons 410 (getvar 'ctab))))))
-
@DavidP Yes, you do need to activate each layout in order for the vports to come alive. So looping through them is a good way to deal with this.
-
Code 68 and 69 is not consistent and when you first open a drawing most of these codes show 0 for a value... When you switch to the each of the layouts the value updates. So for now looping through the layouts and zooming extents appears to solve the issue. Then I'm just filtering for 69 > 1.. still a bit confused. Also these values in some case are -1 but still valid viewports and I run a second time and changes to positive value.. Still not 100% sure of what's going on.
