Jump to content

Line and Curve Renumbering LISP


broncos15

Recommended Posts

So I am trying to create LISP routine that would allow the user to select a line or curve label and then renumber all the line or curve labels based off of that input. My code is as follows

(defun c:tagrenumbertest ( / *error*)
 (defun *error* (msg)
   (if (not
  (member msg '("Function cancelled" "quit / exit abort"))
)
     (princ (strcat "\nError: " msg))
   )
   (princ)
 )
 (setq ss (LM:ssget "\nSelect label to renumber tag: " '("_+.:E:S"((0 . "AECC_GENERAL_SEGMENT_LABEL")))))
 (if ss
   (progn
     (BRONC:tagrenumber:settings)
     (setq ss1 (ssget "_A" (0 . "AECC_GENERAL_SEGMENT_LABEL")))
     (setq ss1cnt 0
    ss1list nil)
     (repeat (sslength ss1)
(setq ss1list (cons (ssname ss1 ss1cnt) ss1list))
(setq ss1cnt (+ ss1cnt 1))
)
     (setq ss1list (vl-sort ss1list '<))
;;;      I know that it is here where I need to append the list but I can't figure out where the label number is stored
;;;      I have tried looking at the DXF code and the VLA-object information, but I can't seem to find it
     )  
 )
 (princ)
)

;;;This is the answer portion of my code
(defun BRONC:tagrenumber:settings ()
 (initget (+ 2 4))
 (setq *rnttamountans* (cond ((getreal "\nEnter amount to add or subtract <1>: ")) (1) ))
 (initget 1 "Add Subtract")
 (setq *rnttaddsubans* (getkword "\nDo you want to [Add/Subtract] that amount? "))
 )
;;;This redefines the ssget function to allow different inputs. It is courtesy of Lee Mac
(defun LM:ssget ( msg arg / ss )
   (princ msg)
   (setvar 'nomutt 1)
   (setq ss (vl-catch-all-apply 'ssget arg))
   (setvar 'nomutt 0)
   (if (not (vl-catch-all-error-p ss)) ss)
)

Unfortunately as you can see in my code, I can't find the DXF or VLA-object information. Does anyone have any suggestions?

Link to comment
Share on other sites

So I have looked in other threads and I still can't find any information on it. Is this something that might be better to code in .NET vs LISP?

Link to comment
Share on other sites

can't help because never seen this "AECC_GENERAL_SEGMENT_LABEL" before, proxy entity?

what you get by entget or dump?

i recall hippe BIGAL BlackBox etc.. using civil3D, hope they can jump in

Link to comment
Share on other sites

can't help because never seen this "AECC_GENERAL_SEGMENT_LABEL" before, proxy entity?

what you get by entget or dump?

i recall hippe BIGAL BlackBox etc.. using civil3D, hope they can jump in

Using entget I get
(-1 . <Entity name: 7ffff729d10>)
(0 . "AECC_GENERAL_SEGMENT_LABEL")
(330 . <Entity name: 7ffff75f9f0>)
(5 . "87151")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "C-ANNO-LABL")
(100 . "AeccDbEntity")
(100 . "AeccDbLabeling")
(100 . "AeccDbLabel")
(100 . "AeccDbGeneralLabel")

for dumpvla I get

Select object: ; IAeccGeneralLabel: IAeccGeneralLabel interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000002f9cbc70>
;   CurveLabelStyle = #<VLA-OBJECT IAeccLabelStyle 00000000479aa1d0>
;   CurveLabelStyleName = "_G-100-CurveTag-usr"
;   Description = Civil 3D API: The parameter is incorrect.
;   DisplayName (RO) = Civil 3D API: The parameter is incorrect.
;   Document (RO) = #<VLA-OBJECT IAeccDocument 00000000443a6f10>
;   EntityTransparency = "ByLayer"
;   Flipped = 0
;   Handle (RO) = "87151"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000047a6ad68>
;   LabelStyle = Civil 3D API: Unspecified error
;   Layer = "C-ANNO-LABL"
;   LineLabelStyle = #<VLA-OBJECT IAeccLabelStyle 00000000479aa6d0>
;   LineLabelStyleName = "_G-100-Tag-usr"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = Civil 3D API: The parameter is incorrect.
;   ObjectID (RO) = 43
;   ObjectName (RO) = "AeccDbGeneralLabel"
;   OwnerID (RO) = 44
;   Pinned = 0
;   PlotStyleName = "ByLayer"
;   Reversed = 0
;   ShowToolTip = Civil 3D API: The parameter is incorrect.
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000047a68360>
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   IsReferenceObject ()
;   IsReferenceStale ()
;   IsReferenceSubObject ()
;   IsReferenceValid ()
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()[

Any help on this issue would be much appreciated because I am utterly perplexed on how to get the information.

Link to comment
Share on other sites

So after looking into this more, I am still stuck. I have looked into using Lee Mac's list box routine as a workaround (which is awesome by the way), but I feel like I still need to understand how the labels work in order to use it correctly.

Link to comment
Share on other sites

  • 3 months later...

I have continued to mess around with this routine because for some reasons the line and curve tags in autocad are the most finicky aspect of Civil 3D. For example, when I label line and curve using the multiple segment command, about 1/3 of the time it skips some random number. For example, I have had it do L1, L2, L3, L5, L6, L7, L9 before. To fix this glitch, I wanted to just allow the user to select L5, and then tell to either add or subtract a given amount (in this instance subtract 1). I know how to do the rest of the code if I can figure out where all this information is stored. Maybe BigAL, Hippe013, or BlackBox know because I am pretty sure they all use Civil 3D.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...