Jump to content

Search the Community

Showing results for tags 'layer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. Hello. Is it possible to write a lisp routine that could get all elements in model space, take whatever layers they are on, and extract all the layer properties into a spreadsheet? I have attached a sample cad file replicated to what I need to do. so basically, we get a raw cad file which some of the elements are being controlled by the colors. Now, I need to put the elements according to the following layer naming convention: Layer Cyan >> TL-1 Layer E >> TL-2 Layer Green >> TL-3 Layer RedStuff >> TL-4 Layer GROUND >> TL-5 Layer Yellow >> TL-6 But my problem is some other elements are on the same layer but different in color which is supposed to be put on a different layer such as: Color magenta >> TL-7 color blue >> TL-8 color whit >> TL-9 I only thought maybe I could just get all the elements properties and sort it out using excel sheet and manually do a simple script to change their layers and stuffs once I already know the specific colors to get that is present in my model space. quick select is a good option to do it but I got a bunch of drawings and bunch of elements in one drawing and it's so tedious to do it manually like that. I am open to any other easier suggestions if there's any and thank you in advance for any help. Drawing1.dwg
  2. Dear All, Im Trying Create Layer with Dimension Style and selected dimension change layer name but not working properly. plase help me completed code . (defun c:Test-11 () (setvar "cmdecho" 0) (setvar "CELTSCALE" 3) ;;------------------------------------ Create Layer ----------------------------------- ; (if (not (tblsearch "LAYER" "TEST DIM-50")) (command "_.layer" "n" "TEST DIM-50" "_color" "1" "CENTER" "_ltype" "CENTER" "CENTER" "") ) ;------------------------------------ (if (not (tblsearch "layer" "TEST DIM-100")) (command "layer" "n" "TEST DIM-100" "") ) ;;------------------------------------ Create Text Style ----------------------------------- ; (if (not (tblsearch "STYLE" "")) (progn (command "STYLE" "TEST TXT-100" "ARIAL" "0" "0.7" "0" "n" "n" "n") (setvar "TEXTSTYLE" "TEST TXT-100") (command "STYLE" "TEST TXT-50" "ARIAL" "0" "0.7" "0" "n" "n" "n") (setvar "TEXTSTYLE" "TEST TXT-50") ) ) ;;------------------------------------ Create Dim Style (TEST DIM-100) ------------------------------------ ;; (if (not (tblsearch "DIMSTYLE" "TEST DIM-100")) (progn (setvar "DIMDLI" 2) ; Baseline spacing (setvar "DIMexe" 2) ; Beyond dimension line (setvar "DIMexo" 2) ; Start offset (setvar "DIMASZ" 2) ; Arrow Size (setvar "DIMTXT" 3) ; Text Height (setvar "DIMTAD" 1) ; Text position vertical (setvar "DIMJUST" 0) ; Text Position Horizontal (setvar "DIMTOH" 1) ; Text Height (setvar "DIMGAP" 0.3) ; Text Offset (setvar "DIMATFIT" 3) ; Text arrow adjustment options (setvar "DIMDEC" 1) ; Decimal places for annotation (setvar "DIMLFAC" 10) ; Scale Factor (setvar "DIMZIN" 8) ; Subsequent zero elimination (setvar "DIMAUNIT" 1) ; Unit format (setvar "DIMAZIN" 2) ; Angle subsequent zeroing (setvar "DIMADEC" 5) ; Decimal places for angle dimensioning (SETVAR "DIMZIN" 8) ; Control zero elimination (command "DIMTXSTY" "TEST TXT-100") ;Specifies the text style of the dimension. (command "DIMSTYLE" "S" "TEST DIM-100") ;Creates and modifies dimension styles. ) ) ;;------------------------------------ Create Dim Style (TEST DIM-50) ------------------------------------ ;; (if (not (tblsearch "DIMSTYLE" "TEST DIM-50")) (progn (setvar "DIMDLI" 2) ; Baseline spacing (setvar "DIMexe" 2) ; Beyond dimension line (setvar "DIMexo" 2) ; Start offset (setvar "DIMASZ" 2) ; Arrow Size (setvar "DIMTXT" 3) ; Text Height (setvar "DIMTAD" 1) ; Text position vertical (setvar "DIMJUST" 0) ; Text Position Horizontal (setvar "DIMTOH" 1) ; Text Height (setvar "DIMGAP" 0.3) ; Text Offset (setvar "DIMATFIT" 3) ; Text arrow adjustment options (setvar "DIMDEC" 1) ; Decimal places for annotation (setvar "DIMLFAC" 5) ; Scale Factor (setvar "DIMZIN" 8) ; Subsequent zero elimination (setvar "DIMAUNIT" 1) ; Unit format (setvar "DIMAZIN" 2) ; Angle subsequent zeroing (setvar "DIMADEC" 5) ; Decimal places for angle dimensioning (SETVAR "DIMZIN" 8) ; Control zero elimination (command "DIMTXSTY" "TEST TXT-50") ;Specifies the text style of the dimension. (command "DIMSTYLE" "S" "TEST DIM-50") ;Creates and modifies dimension styles. ) ) ;;------------------------------------ Dim Style (TEST DIM-100) ------------------------------------ ;; (defun C:testdim100 (/ ss n ddata) (if (setq ss (ssget "_:L" '((0 . "DIMENSION")))) (progn ; then (command "_.chprop" ss "" "_layer" "TEST DIM-100" "") (repeat (setq n (sslength ss)) (setq ddata (entget (ssname ss (setq n (1- n))))) (entmod (subst '(3 . "Annotative") (assoc 3 ddata) ddata)) ) ; repeat ) ; progn ) ; if ) ; defun ;;------------------------------------ Dim Style (TEST DIM-50) ------------------------------------ ;; ; not wotking :| (defun C:testdim50 (/ ss n ddata) (if (setq ss (ssget "_:L" '((0 . "DIMENSION")))) (progn ; then (command "_.chprop" ss "" "_layer" "TEST DIM-50" "") (repeat (setq n (sslength ss)) (setq ddata (entget (ssname ss (setq n (1- n))))) (entmod (subst '(3 . "Annotative") (assoc 3 ddata) ddata)) ) ; repeat ) ; progn ) ; if ) ; defun |; ;;---------------------------------------------------------------------------------------------- (command "DIMSTYLE" "r" "TEST DIM-100") (command "DIMSTYLE" "r" "TEST DIM-50") (setvar "cmdecho" 1) (princ) )
  3. I am quite busy, of course, like everyone, I have loads of work needing to get done so I thought I would make this quick post. Hopefully someone with the available time can help out! I basically need a simple routine to change colors from our old standards to our new standards. I am sure it is most likely the simplest routine but if someone could post one and save me a little bit of time I would appreciate it. An example would be layer: TEXT, which with our old standards for 30+ years has been the 'GREEN', we have now changed that and are using color '104' which is more of a turtle green, anyways thats what the boss wants so that's what the boss gets. Currently when we open a drawing that was drawn, say, 10 years ago, it has all of our old layers and their respective old colors. I just need a lisp that would run every time we open a drawing for editing or revisions that would automatically search for the layers and change their properties (colors)..
  4. Hello, I currently use a routine that offsets a line in both directions based on a specified distance in the routine. After we run the command we usually have to select the two offset lines and put them on a specific layer, in this case "Structure". I am trying to just add to the routine so the offset lines are automatically put on that layer for us but for some reason when we run the routine its putting all 3 lines (the original, and the two offset lines) on that layer. Can someone review it over and respond. Thanks (defun C:OFF (/ pickEnt pickObj offDist) (vl-load-com) (setq offDist 0.0812) (while (setq pickEnt (entsel)) (cond ((and pickEnt (setq pickObj (vlax-EName->vla-Object (car pickEnt))) offDist) (vla-put-layer pickObj "STRUCTURE" ) (vla-Offset pickObj offDist) (vla-Offset pickObj (- offDist)) ) ) ;_ end of cond ) ;_ end of while (princ) ) ;_ end of defun
  5. I received a drawing that contains a layer in the manager box. But when I attempted to Quick Select that layer, the result returns as "0" and this same layer cannot be deleted, since the message tells me that layers with objects cannot be deleted. I thawed all layers and still get "0" and the layer won't delete. This should mean that the layer is hidden inside a block. This drawing has several hundreds of blocks! Is there an application within AutoCAD that will reveal to me which block that layer is in?
  6. RubberDinero

    Change entity layer

    At my job, i have a very tedious job of changing layers from proposed to existing and vice versa our layer setup is very basic "LayerName"=existing layer "LayerName-PR"=Proposed layer. i have recently bought a book to to learn AutoLisp and I've gotten the basic concept. I know that i want to ssget LayerName and setq that name to L then CHPROP LA to L-PR. but i want to know if someone has anything like this already and could help me. I'd like to do a mass select and have it automatically change the entities to their respective PR layer. also vice versa, to remove PR. i'm not looking for a layer renaming lisp. i'm looking for a entity layer changing lisp. anything helps. thanks.
  7. I have an object and I want to turn its layer off but it is locked or anything else which I can’t select the object and find its layer. Due to lots of layers I can’t try one-by-one. What is the best way to fnd its layer?
  8. Color of an Object, in a layer is not ‘ByLayer’. I try to change to ‘by layer’ through object properties but it doesn’t accept and keeps the color. What is the reason and how can I change it into another color?
  9. Hi. I've asked a question like this before. But I couldn't solve it, so I asked for your help again. (Emmanuel Delay's lisp does not add up the numbers...) There are numbers(mtext) assigned to different layers. I'd like to get the total of each of these numbers by layer. ex) Layer / Contents AA / 1.5 AA / 2.5 AA / 1.0 => BB / 2.0 BB / 2.0 And I want to tabulate those values with the layer name and the sum. I am attaching the type of lisp I want. But it's not perfect for me to use. So I want to modify it and use it, but it is a vlx format. Please make the same lisp as above. textcount.lsp SAMPLE.dwg pdtt.VLX
  10. I want to delete Xref-dependent layer. AutoCAd says I can't delete them. I want to delete them. How can I do that?
  11. First of all, I'm not asking anyone to write this for me... I'm asking if they can point me to an existing routine if it indeed exists.. I have a legacy drawing where everything is on Layer 0 and all the entities have colors assigned to them. I am looking for an existing routine <Hopefully!> that will take all the red objects and move them to a new layer called 1 for color 1. Same thing for each color used in the drawing. When done, nothing would be on Layer 0. I've looked and in my searching I've had no luck. = = I did find this: http://forums.augi.com/showthread.php?110777-Select-by-colour-and-move-to-layer I login to the site, my name appears but when I go to this page, it does not show me logged in (so I cannot look at the code) I pick Login, it takes me to the main page (and shows me logged in) I cannot click the link..
  12. Does anyone know how can i fix the issue when my layer manager is not showing in full screen, it only shows in small window just like picture below, i tried to drag the bottom window down to see me but it won't let me. i closed dwg and re open but it was till the same. is there any command i need to set to get it as normal. i have about 157 layers for this dwg, i want to turn off 156 layers and leave one turn on...............thank you for any help.
  13. Hello, I am attempting to put together a LISP that creates a table of cumulative geometric properties of selected objects. I would like to be able to quantify Erosion and Sedimentation Control BMPs by layer for a cost estimation. Controls such as compost filter sock and orange construction fence are polylines, erosion control blanket is hatched, and inlet protection is a block. The controls are all on their own respective layers. The idea is that I would be able to select one occurrence of each of these controls (polyline, hatch, block), have the LISP apply the "select similar" command, and create a table that reports back the length of the polylines by layer, the cumulative area of the hatches by layer, and a count of the blocks by layer. Due to my inexperience with LISP, I am afraid that I am unable to create this app in time for when I need it. It would be greatly appreciated if someone could help out in creating this app. Thank you for your time.
  14. Hello, I'm searching to make a LISP, to change the layer of an attribute. Actually it in "TopoAlt" Layer, I like to change in "0" layer (or other) I thinked about DXF code but i don't find it with dumpallproperties. "Battman" command would be a good solution but I can't make script "-eattedit" command is pretty close but I'm stopped when It need " attribute selection". If i could scripting "-eattedit" with an automatic attribute selection (like an already made SSGET), I could change the layer, or other properties ! Any Idea ?
  15. Hi, I would like a command to do the opposite of layiso. The layers of the selected entities should be turned off. Thanks in advance.
  16. We regularly export Civil3D files to CAD so we can use them in either CAD and Revit. We have run into a few problems with this workflow, since any xrefs that aren't detached before exporting become blocks in the CAD file. Additionally, Revit automatically enables all the layers when you insert the CAD file, so you have to manually disable them again. I have created a simple lisp that detaches the xrefs and deletes the listed layers using code I pulled from various forums. However, I've got two issues: 1. The dellayers function claims to delete the DR_X_Text layer, but the layer and the entities on that layer remain in my drawing after running the command. 2. I'd like to princ the list of removed xrefs as well, but I'm not sure where to place that code. (defun c:Civil3DtoCAD (/) (c:detachxrefs) (c:dellayers) (princ) ) (defun c:dellayers (/ e) (foreach layer '("DR_X_Text" "_11-2606G1K-1-24" "_11-2607G1K-1-24" "_11-2608G1K-1-24") (if (setq e (tblobjname "layer" layer)) (progn (vl-catch-all-apply 'vla-delete (list (vlax-ename->vla-object e))) (princ "Layer ") (princ layer) (princ " deleted.\n") ) (progn (princ "Layer ") (princ layer) (princ " not found.\n") ) ) ) (princ) ) (defun C:Detachall (/ *error* mip:layer-status-restore mip:layer-status-save delete-xref-img-underlay delete-all-dict ) (vl-load-com) (defun *error* (msg) (mip:layer-status-restore) (princ msg) (princ) ) ;_ end of defun (defun mip:layer-status-restore () (foreach item *PD_LAYER_LST* (if (not (vlax-erased-p (car item))) (vl-catch-all-apply '(lambda () (vla-put-lock (car item) (cdr (assoc "lock" (cdr item)))) (vla-put-freeze (car item) (cdr (assoc "freeze" (cdr item))) ) ;_ end of vla-put-freeze ) ;_ end of lambda ) ;_ end of vl-catch-all-apply ) ;_ end of if ) ;_ end of foreach (setq *PD_LAYER_LST* nil) ) ;_ end of defun (defun mip:layer-status-save () (setq *PD_LAYER_LST* nil) (vlax-for item (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)) ) ;_ end of vla-get-layers (setq *PD_LAYER_LST* (cons (list item (cons "freeze" (vla-get-freeze item)) (cons "lock" (vla-get-lock item)) ) ;_ end of cons *PD_LAYER_LST* ) ;_ end of cons ) ;_ end of setq (vla-put-lock item :vlax-false) (if (= (vla-get-freeze item) :vlax-true) (vl-catch-all-apply '(lambda () (vla-put-freeze item :vlax-false)) ) ;_ end of vl-catch-all-apply ) ;_ end of if ) ;_ end of vlax-for ) ;_ end of defun (defun delete-xref-img-underlay (/ count txt) (mip:layer-status-save) (vlax-for Blk (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object)) ) ;_ end of vla-get-Blocks (if (and (= (vla-get-IsXref Blk) :vlax-false) (not (wcmatch (vla-get-name Blk) "*|*")) ) ;_ end of and (progn (setq count 0 txt (strcat " Erase Xref and Underlay in " (vla-get-name Blk) ) ;_ end of strcat ) ;_ end of setq (grtext -1 txt) (vlax-for Obj Blk (setq count (1+ count)) (if (zerop (rem count 10)) (grtext -1 (strcat txt " : " (itoa count))) ) ;_ end of if (if (and (vlax-write-enabled-p Obj) (or (and ;_ XREF (= (vla-get-ObjectName obj) "AcDbBlockReference") (vlax-property-available-p Obj "Path") ) ;_ end of and (and ;_ UNDERLAY (wcmatch (vla-get-ObjectName obj) "*Reference") (vlax-property-available-p Obj "UnderlayName") ) ;_ end of and (= (vla-get-ObjectName obj) "AcDbRasterImage") ;_ IMAGE ) ;_ end of or ) ;_ end of and (VL-CATCH-ALL-APPLY 'vla-Delete (list Obj)) ) ;_ end of if ) ;_ end of vlax-for ) ;_ end of progn ) ;_ end of if ) ;_ end of vlax-for (mip:layer-status-restore) ) ;_ end of defun (defun delete-all-dict (dict) ;;; dict - dict name (like "ACAD_IMAGE_DICT", "ACAD_PDFDEFINITIONS" ... ) (vl-catch-all-apply '(lambda () (vlax-map-Collection (vla-item (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)) ) ;_ end of vla-get-dictionaries dict ;_ "ACAD_IMAGE_DICT" ) ;_ end of vla-Item 'vla-delete ) ;_ end of vlax-map-Collection ) ;_ end of lambda ) ;_ end of vl-catch-all-apply ) ;_ end of defun (vl-load-com) (delete-xref-img-underlay) (command "_-xref" "_d" "*") (while (> (getvar "CMDACTIVE") 0) (command)) (mapcar 'delete-all-dict (list "ACAD_IMAGE_DICT" "ACAD_PDFDEFINITIONS" "ACAD_DWFDEFINITIONS" "ACAD_DGNDEFINITIONS" ) ;_ end of list ) ;_ end of mapcar (command "_.regenall") (command "_.externalreferences") (princ) ) ;_ end of defun (defun c:detachxrefs ( / block-lst xref-lst nxt-blk n) (PROGN (SETQ block-lst (LIST (TBLNEXT "BLOCK" T))) (SETQ xref-lst NIL) (WHILE (SETQ nxt-blk (TBLNEXT "BLOCK")) (SETQ block-lst (APPEND block-lst (LIST nxt-blk))) ) ;_ end of WHILE (FOREACH n block-lst (IF (AND (ASSOC 70 n) (EQ (BOOLE 1 4 (CDR (ASSOC 70 n))) 4)) (SETQ xref-lst (APPEND xref-lst (LIST (LIST (CDR (ASSOC 2 n)) (CDR (ASSOC 1 n))) ) ;_ end of LIST ) ;_ end of APPEND ) ;_ end of SETQ ) ;_ end of IF ) ;_ end of FOREACH (IF xref-lst (c:detachall) (PROGN (PRINC "\nNo References to Detach... ") (PRINC) ) ) ;_ end of IF (PRINC) ) ;_ end of PROGN ) ;_ end of defun
  17. Hello, I have a lot of drawings comming from an export f.e. Tekla stuctures. Those drawings have no layer structure, only thing to categorize entities are the colors. Is it possible to create layers per color and get the entities in that layer? Thanks in advance 1A - Fundering.dwg
  18. What is the problem? It's not working when am offsetting its not coming, (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) (setq ilyrc(getstring(strcat "\Specify insulation layer <" (vl-princ-to-string ilyr)"> : "))) (setq layers (vla-get-Layers doc)) (setq ilyr (vla-Add layers ilyrc)) (setq plyr (vla-get-ActiveLayer doc))) (function (lambda (x) (vla-offset x (+ *ff)) (vla-put-layer (vlax-EName->vla-Object (entlast))plyr) (vla-offset x (+ iszo)) (vla-put-layer (vlax-EName->vla-Object (entlast))ilyr) (vla-offset x (- *ff)) (vla-put-layer (vlax-EName->vla-Object (entlast))plyr) (vla-offset x (- iszo)) (vla-put-layer (vlax-EName->vla-Object (entlast))ilyr)))
  19. Hi everyone, I'm trying to write a code that will 1) set the current plot style to "BCR Plot Style.stb" 2) change all layer properties to plot style "Grayscale" I had this working at one point, but can't get it to work when I reopen, so it may just be a problem with how I'm loading the routine. I've added it to LISP files under CUI and to my APPLOAD startup suite. (defun c:grayscale () (vl-load-com) (vla-put-StyleSheet (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object)) ) "BCR Plot Style.stb" ) (setq layers (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (vlax-for l layers (progn (vla-put-plotstylename l "Grayscale") ) ) ) Help is greatly appreciated!
  20. Find and correctly map wrong layers in ACAD group Hi, I have a problem with layers grouped in Acad groups. These layers are partially in the wrong group. Short description: There are several groups in my drawing in which different layers have to be grouped uniformly. Certain groups must contain specific layers. For example, a group includes layers that are somewhere in the layer name "Layer 1". There is no layer in the drawing that does not belong to a group. There must be no nested groups. For example, in: Group A will be all Layer 1. In group B all Layer 2. In group C all layers 3. etc....... However, it can happen that a wrong layer or several wrong layers were mistakenly assigned to a group. How can I find the wrong layers in the groups and remove them from the groups and then the right one Assign groups? A solution would be a great help. Martin Beispielzeichnung.dwg
  21. Alan_KD

    XREF layer

    Hello everyone, I have been developing some routines for the pas 6 months, so my knowledge is not very high. Normally I manage to find answers online, thanks to all of you who share their knowledge, it's so helpful. I am writing a routine which would: Compare the XREF name on the drawing and the XREF 'real' file name and match them (on the drawing) if different. After the code checks if the XREF name matches a specific formatting and if it does creates a layer based on it (if the layer does not already exist). The final step is to change the XREF layer to that one, and here is where I am getting an error. I tried with different ways to do this and always got an error. I guess I could try to get this done without using vl code but this is really puzzling me and I would like to know why is actually not working, I dont see where the code could have gone wrong. The example names of my XREFs: which are used to compare with the wcmatch "*_*_*_*" XREF_TGLMTE_PRO_INTER_BASSINS_01 XREF_TGLMTE_PRO_INTER_RESEAUX_HS_2025_01 XREF_TGLMTE_PRO_TRC_V5_IND_D I used different lines of code to try to achieve this, as you can see on my commented lines on the code. I am currently using a (vlax-put-property it2 'layer strcalq) inside a vlax-for getting the following error: (defun c:xrcalque (/ AcadObj AcadAct LyAct it2 xrobjectname strcalq) (vl-load-com) (setq *error* ABD:Error) (setq AcadObj (vlax-get-Acad-Object)) (setq AcadAct (vla-get-ActiveDocument AcadObj)) (setq LyAct (vla-get-layers AcadAct)) ;get layers from Active document (xrn AcadObj AcadAct); runs the subroutine to change XREF name on drawing to match XREF file name (vlax-for it2 (vla-get-blocks AcadAct) (setq ind1 3) (setq ind2 0) (setq ind3 0) (if (= (vla-get-isxref it2) :vlax-true) (progn (setq xrobjectname (vl-filename-base (vla-get-name it2))) (if (wcmatch xrobjectname "*_*_*_*"); (progn (repeat ind1 (setq ind3 (+ ind2 1)) (setq ind2 (vl-string-position (ascii "_") xrobjectname ind3));gets firs position of "_" character ) (print xrobjectname) (setq ind2 (+ ind2 2)) (print ind2) ; ind2 is the position of the ind1 "_" element (3rd) to count from there to have the layer name (setq ind4 (vl-string-position (ascii "_") xrobjectname nil T)); last "_" position (setq ind5 (vl-string-position (ascii "-") xrobjectname nil T)); last "-" position (if (> ind4 ind5)(setq indlst ind4)(setq indlst ind5)) ;check which one is bigger (setq indlst (+ 1 indlst)) (setq strcalq (strcat "SF-XREF_"(substr xrobjectname ind2 (- indlst ind2)))) ;Create layer with string from ind2 position to ind4 or ind5 position (strcalq) (print strcalq) (if (not (tblsearch "LAYER" strcalq));checks non existance of layer (progn (vla-add LyAct strcalq) (print "Layer has been created") ) (progn ;(vla-put-layer it2 "0") ; (print "this is a test4") (print "layer exists") ;if layer exists put object on layer ) );if (print strcalq) ;(vla-put-layer it2 "0") ;(vla-put-layer xrobjectname strcalq) ;(vla-put-layer (vla-get-name it2) strcalq) ;(vlax-put it2 'Layer "0") ;(vlax-put (vlax-ename->vla-object (vla-get-name it2)) 'Layer "0") (vlax-put-property it2 'layer strcalq);############ ERROR############### );progn (print "wcmatch xref name not matching") );if );progn );if ;(vlax-put (vlax-ename->vla-object xrtemp) 'Layer strcalq) );vlax for (print "highly recommended to purge layers") ;add code to purge automatically the layers? (princ) );defun ;;;======================================= Error function ++++++++++++++++++++++++++++++++++++++++;;; (defun ABD:Error (st) (if (not (member st (list "Fonction annulée" "quitter / sortir abandon"))) (vl-bt) );if ;(princ "Merci d'envoyer vos commentaires ou report d'erreurs à ") (princ);clean exit ? );defun error ;;;======================================= function xrn +++++++++++++++++++++++++++++++++++++++++++;;; (defun xrn (AcadObj AcadAct / item xrobjectnamexrn xrfilenamexrn) (vlax-for item (vla-get-blocks AcadAct) (if (= (vla-get-isxref item) :vlax-true) (progn (setq xrobjectnamexrn (vl-filename-base (vla-get-name item))) (setq xrfilenamexrn (vl-filename-base (vla-get-path item))) (if (/= xrobjectnamexrn xrfilenamexrn) (progn (vla-put-name item xrfilenamexrn) (vla-reload item) ) ) ) ) ) );defun xrn If someone could explain why this is not working, and please share a way to achieve my goal would be awesome! Thank you in advance, Alan
  22. hi, any way to improve below lisp? it create new layer and new viewport but after layerp command execute the layer color goes back to white and no plot becomes plot again. (defun c:vp() (command ".layer" "M" "viewport" "C" "8" "viewport" "P" "N" "viewport" "" "-VPORTS" pause pause ".layerp") (princ) )
  23. Currently the view port color over write doesn't effect the colors of nested blocks. The nested blocks show the global color of the layer. Ideally VP color over write should behave same as changing global color of layer. Is there a way to achieve it (beside exploding the blocks to remove nesting). For example see attached sample file. I want all elements in the blocks to have the overwritten color in the view port i.e. color 20, instead it is showing the nested blocks as yellow which is not what i want. sample.dwg
  24. User is running AutoCAD 2017. Every so often after closing AutoCAD, and restarting it, the layer palette positions itself as shown in the screenshot with no user interaction. Even more bizarre, user was just given a NEW PC with a fresh install, and no "migration" was done. This still happens on new PC occasionally. Any thoughts?
  25. (sssetfirst nil (ssget "_X" '((8 . "5")))) will select objects in layer 5 no problem but when i incorporate (getvar "CLAYER") to make: (sssetfirst nil (ssget "_X" '((8 . (getvar "CLAYER"))))) It comes back with error: ; error: bad SSGET list value It's probably just a simple fix (heck, maybe even a standard command to do the same) Thanks in advance.
×
×
  • Create New...