Recent Posts

Pages: [1] 2 3 ... 10
I tried the first suggestion by ronjonp and it worked great!

Thank you very much for the help and the fast response. Perfect.
Glad to help.  :-)
OK, did some more sleuthing using Lee Mac's code Modified thusly:

Code: [Select]
; Layer Director by Lee McDonnell (MODIFIED)


(if (not cmdReactor)
   (setq cmdReactor
        '((:vlr-commandWillstart . startCommand)
          (:vlr-commandEnded . endcommand)
          (:vlr-commandCancelled . cancelCommand)
        ) ; end command reactor
   ) ; end setq
) ; end if

(defun startCommand (calling-reactor startcommandInfo / thecommandstart)
   (setq oldlay (getvar "clayer"))
   (setq thecommandstart (car startcommandInfo))
   (if    (= thecommandstart "PLACEVIEW")
   (setvar "clayer" "L-PS-VPORT")
   ) ;_  end if
) ; end startcommand

(defun endCommand (calling-reactor endcommandInfo / thecommandend)
   (setq thecommandend (car endcommandInfo))
   (if    (= thecommandend "PLACEVIEW")
   ---->(alert "PLACEVIEW DONE!")<-----
   ) ;_  end if
) ; end endCommand

(defun cancelCommand (calling-reactor cancelcommandInfo / thecommandcancel)
   (setq thecommandcancel (car cancelcommandInfo))
   (if    (= thecommandcancel "INSERT")
   (setvar "clayer" oldlay)
   ) ;_  end if
) ; end cancelCommand

This creates a dialog box when the PLACEVIEW command completes.  As you can see, the PLACEVIEW command completes prior to the view label being placed.

See attached image "PV1.png"

After clicking 'OK' the view label is placed.

See attached image "PV2.png"

So I guess what I need to know is what command is issued after PLACEVIEW that inserts the viewlabel, and if that command is VIEWLABLE, why is the reactor not grabbing it?

Thanks as always for your help folks
AutoLISP (Vanilla / Visual) / Re: LEE MAC menu bar
« Last post by RGUS on Today at 12:38:30 PM »
Ok, I'm curious now, what is the PAYAZED MENU BAR and where can i find it?
This is his webpage

Edit: and the download link is there

Thanks very much, Google didn't return anything when I searched.
Comparing Excel to CSV is comparing apples to oranges. CSV is for keeping "records" and Excel is used for making calculations-i.e. applying a compounding interest rate over 25 years-; meaning, you shouldn't be keeping your static records/data in an excel files. If you have "pipe/beam/thing size data", "weather data for 1000 years", etc. all that information should be stored in a CSV not excel (retrieving static type data from a proprietary format is far too inefficient).

Step up your game.
I previously suspected:

The point here is that could be the attributeDefinition added in this way is not properly initialized due to how BricsCAD implement its .NET API

It looks like it has been proved: it is BricsCAD's .NET API implementation bug: AttributeDefinition has 0 height if not explicitly set.

I tried this with AutoCAD:

1. Create a TextStyle with its Text Height=0.0, and set this TextStyle as current (so, if Text/Attribute Def/Ref is created and its text style is not specified, this text Style would be used).

2. If manually create text/attribute definition in AutoCAD, and this Text Style is used, AutoCAD always gives a default text height of 0.2, and one cannot set the height to 0.0.

3, Following code adds attribute definition to an existing block (the same as the OP) without setting any property (so, the attribute definition would use current text style):

Code: [Select]
       private static ObjectId UpdateBlockDefinition(Document dwg)
            var blkId = ObjectId.Null;
            var blkName = "TestBlock";

            using (var tran=dwg.TransactionManager.StartTransaction())
                var bt = (BlockTable)tran.GetObject(dwg.Database.BlockTableId, OpenMode.ForRead);
                if (bt.Has(blkName))
                    blkId = bt[blkName];

                    var blk = (BlockTableRecord)tran.GetObject(blkId, OpenMode.ForWrite);
                    var att = new AttributeDefinition();
                    att.Tag = "TAG A";
                    [color=blue]// att = 0.0 //When I explicitly try to set height to 0.0, AutoCAD raises exception[/color]
                    tran.AddNewlyCreatedDBObject(att, true);


            return blkId;

When I examine the varaiable "att" in debugging when a break point is placed in the red line, I can see AutoCAD set its height to 0.2 in spite the TextStyle applied to it has text height being 0.0 and the code does not explicitly set the attribute definition's height. Also, the blue line of code indicates that attribute definition height cannot be 0.0.

So, that is why the OP's code works in AutoCAD.

Since the same code does not work in BriscCAD, one could do the same debugging to examine if BricsCAD somehow makes/allows 0.0 height attribute definition being added into block definition. If so, that is BricsCAD's bug.
Thank you Dlanor for the workaround of removing the extra quotes. Works great.

No problem.  :-)
AutoLISP (Vanilla / Visual) / Re: Radio_button controls and list boxes.
« Last post by snownut2 on Today at 08:37:38 AM »
This is untested but should work...

Code - Auto/Visual Lisp: [Select]
  1. ;  DCL Bit
  2. : boxed_row {
  3. :   radio_column { key = "action" ; }
  4. :     radio_button { label = "Draw Line" ; key = "linel" ; }
  5. :     radio_button { label = "Add Text"  ;  key = "textl" ; }
  6. :   }
  7. :   column {
  8. :     text { label = "Select Layer" ;   }
  9. :     list_box { key = "layname"  ;    }
  10. :   }
  11. : }
  14. ;  LISP Bit (Due to BricsCads habit of selecting 1st radio option, need to pre-define values in case user doesn't select radio button)
  16.   linel '("line 1" "line 2" "line 3")
  17.   textl '("text 1" "text 2" "text 3")
  18.   layname (car linel)
  19. )
  20. ; ----- load dcl here -----
  22. (start_list "layname")
  23. (mapcar 'add_list linel)
  24. (set_tile "action" "linel")
  26. (action_tile "action"  "(start_list \"layname\")(mapcar 'add_list (read $value))(end_list)")
  27. (action_tile "layname" "(set (read $key) (nth (atoi $value) (read(get_tile \"action\"))")
I am looking for a way to auto label a plan sheet via the xref layers with a MLeader. Then Create a Legend with a Mtext.

this is the overall idea and I know its a mess (sorry)...


(Auto Label selection with a MLeader Note bubble )
If I were to select an object via an xref and get the layer name.
Have it look up the layer keyword and place Abbreviation in the MLeader Note bubble.

Would it be possible for the routine could match layer to a keyword?
If the routine sees the Layer Name (wildcard)Concrete sidewalk(wildcard); it could be tied to a (CS) note bubble.

If the layer name is
(*SIGN* = SG)

Then place the layer name into the Mleader's Attribute.

(To create the legend)
maybe select all the mleaders.
It could Take the Abbreviation and the Keyword Name with (*)
Place those values in a MText Box.

SG(tab tab)SIGN


Look into a library of common lisp defuns, they can be in 1 lisp or load when required, you hinted at does layer exist, its 1 line in any of your code.

(laymiss (setq lay "Mylayer") 12 "Dashed") so you would have a library defun that checks does layer exist I have hinted option color and line type.

I have library DCL routines they take 2-3 lines of code in any routine asking for values or as a replacement to Initget, they can have 1 input or up to screen limits alphabet works "A-Z" go yo Cadtutor, downloads, Multi Radio and getvals.

eg of initget as a dcl
(if (not AH:Butts)(load "Multi Radio buttons.lsp")) ; loads lisp if its not already loaded
(setq ans (ah:butts but "h"  '("Yes or No" "Yes" "No"))) ; ans holds the button picked value

AutoLISP (Vanilla / Visual) / Re: predifined object snap
« Last post by BIGAL on Today at 04:04:38 AM »
if you know the block geometry then set snap to off as you know the point you want to join to relative to the insertion point of the block, it becomes more complex with X & Y scale and of course rotation adds even more complication. eg block creation insert 0,0 point is 1,1, in dwg inserted at 23,24 so end of line is 24,25.

If it varies say block is a square then ask "which corner" to connect to correct corner.
Pages: [1] 2 3 ... 10