Author Topic: CivilLabels converting ?  (Read 4938 times)

0 Members and 1 Guest are viewing this topic.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
CivilLabels converting ?
« on: November 07, 2012, 03:36:32 AM »
Hello!

I´m not really a friend with the look of CivilLabel (for example boring rotate them...), so I was thinking how can I convert a CivilEntity in a normal AutocadEntitiy - exactly explode the label, but than I get a anonym block without attributes, so I don´t happy also with them. The other thing is, labelValue is a string not a attribut - stupid???

If I pick on a explode lable (->block ) with this code
Code: [Select]
(defun c:test ()
  (if (setq Vent (vlax-ename->vla-object (car (nentsel "\Select a label "))))
    (progn
      (vlax-dump-object Vent t)
      (textpage)
      )
    )
  )

TextString = "{\\Fisocp.shx|c0;79.24}"

So maby there is a way to convert string in a attribut


Any suggestions ?
« Last Edit: November 07, 2012, 03:49:53 AM by cadplayer »

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #1 on: November 07, 2012, 07:01:31 AM »
I´m no expert with Visual so I wondering how I can get entitydata from VLA-object ?

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: CivilLabels converting ?
« Reply #2 on: November 07, 2012, 07:18:32 AM »
I´m no expert with Visual so I wondering how I can get entitydata from VLA-object ?

This may help in that respect:
http://lee-mac.com/entitylist.html

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #3 on: November 07, 2012, 08:06:35 AM »
Thanks Lee, but there I can´t see a str-entity which have my high "79.24". Do you know what type of page comes with "vlax-dump-object vent..." ?

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #4 on: November 07, 2012, 09:42:38 AM »
Code: [Select]
(
    (-1 . <Entity name: 7fffd8f08b0>)
    (0 . "AECC_SURFACE_ELEVATION_LABEL")
    (330 . <Entity name: 7ffff4d09f0>)
    (5 . "48C5B")
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "TERR-TEXT")
    (100 . "AeccDbEntity")
    (100 . "AeccDbLabeling")
    (100 . "AeccDbLabel")
    (100 . "AeccDbFeatureLabel")
    (100 . "AeccDbSurfaceElevLabel")
  )

Nothing I can use to extract high value from label, is there annother way ?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CivilLabels converting ?
« Reply #5 on: November 07, 2012, 10:09:13 AM »
Try this:
Code: [Select]
(defun c:dump (/ ent obj)
  (if (setq ent (entsel "\nSelect entity to get object data: "))
    (progn
      (textscr)
      (setq obj (vlax-ename->vla-object (car ent)))
      (vlax-dump-object obj t)
      (vlax-release-object obj)
      (princ "\n")
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #6 on: November 07, 2012, 10:27:58 AM »
@CAB: Is it not the same I wrote

Don´t missunderstand me, actually I would convert CivilLabel in a block with attribute but my first try is to convert it in a text (little easier for me:) )
The problem here is still to can get the label Value.

Code: [Select]
(defun c:zhp ( / ss vent data pt)
  (prompt "\nSelect labels: \n")
  (setq ss (ssget '((0 . "AECC_SURFACE_ELEVATION_LABEL"))))
  (progn
    (setq I -1)
    (repeat (sslength ss)
      (setq vent (vlax-ename->vla-object (ssname ss (setq I (1+ I)))))
      (setq data (entget vent))
      (setq pt (cdr (assoc 10 pt)))
      (command "text" "s" "txt" (list (nth 0 PT) (nth 1 PT) 0)"" "0"
       (rtos (caddr(cdr(assoc 10 DATA))) 2 2))
      )
    )
  )

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CivilLabels converting ?
« Reply #7 on: November 07, 2012, 10:42:27 AM »
Sorry I should have been more clear.
What is the result of the DUMP?
Post the text page display.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CivilLabels converting ?
« Reply #8 on: November 07, 2012, 10:56:22 AM »
I only have an older version of plain autocad and no time this morning to dig into your drawing.
Examples of how to access a blocks tag string are here.
http://www.theswamp.org/index.php?topic=35183

I think you are trying to get to this point.
(vla-get-tagstring att)

or is it the prompt you are after?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #9 on: November 07, 2012, 11:38:49 AM »
God morning to America from Sweden
Thanks CAP for answer

The label have this properties:
Code: [Select]
Label interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000002dcf9810>
;   Description = Civil 3D API: Felaktig parameter.
;   DisplayName (RO) = Civil 3D API: Felaktig parameter.
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000002dcf59a0>
;   Flipped = 0
;   Handle (RO) = "5A76"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000004b3b1d08>
;   LabelStyle = #<VLA-OBJECT IAeccLabelStyle 000000002de78550>
;   Layer = "TERR-TEXT"
;   LeaderAttachmentOption = 0
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   MarkerStyle = #<VLA-OBJECT IAeccMarkerStyle 000000004be62770>
;   Material = "ByLayer"
;   Name = Civil 3D API: Felaktig parameter.
;   ObjectID (RO) = 1195
;   ObjectID32 (RO) = 1195
;   ObjectName (RO) = "AeccDbSurfaceElevLabel"
;   OwnerID (RO) = 556
;   OwnerID32 (RO) = 556
;   Pinned = 0
;   PlotStyleName = "ByLayer"
;   Reversed = 0
;   ShowToolTip = Civil 3D API: Felaktig parameter.
;   Surface (RO) = #<VLA-OBJECT IAeccTinSurface 000000003e5c5cc0>
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000004b3b9b60>
;   Type (RO) = 9
;   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 ()

But if I explode the label comes a anonym block "*Uxx" and this propertiies
Code: [Select]
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00000001402491d8>
;   AttachmentPoint = 4
;   BackgroundFill = 0
;   Document (RO) = #<VLA-OBJECT IAcadDocument 00000000515ceb00>
;   DrawingDirection = 5
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "5BEB"
;   HasExtensionDictionary (RO) = 0
;   Height = 0.254
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000003c873c08>
;   InsertionPoint = (152619.0 6.40905e+006 0.0)
;   Layer = "TERR-TEXT"
;   LineSpacingDistance = 0.423333
;   LineSpacingFactor = 1.0
;   LineSpacingStyle = 1
;   Linetype = "Continuous"
;   LinetypeScale = 1.0
;   Lineweight = -3
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 1204
;   ObjectID32 (RO) = 1204
;   ObjectName (RO) = "AcDbMText"
;   OwnerID (RO) = 1205
;   OwnerID32 (RO) = 1205
;   PlotStyleName = "Color_1"
;   Rotation = 0.0
;   StyleName = "Standard"
;   TextString = "{\\Fisocp.shx|c0;79.60}" <-----------------------look here !!!
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000003c86d8a0>
;   Visible = -1
;   Width = 0.0
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   FieldCode ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

So here we are, I can see my high value, but it´s a string I would like have a attribute.
I don´t know if it´s right way I look for... :|

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #10 on: November 15, 2012, 08:20:31 AM »
Is it possible to get entityData from a Civil Label via Auto/VisualLisp (COM) or can I do this only in CivilAPI ?

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: CivilLabels converting ?
« Reply #11 on: November 15, 2012, 09:13:25 AM »
You cannot directly get the value of a C3D label object with any API. At least not that I have been able to find.

What is it you want to do with the labels that is so unfriendly and boring?

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #12 on: November 16, 2012, 01:10:12 AM »
Thanks for replaying.
Mainproblem is how can I rotate fast labels so they display correctly direction in planview. Second thing is if I want interpolate between labels I need a value to can calculate new interpolated value. The point is sometimes I work faster if I generate mainhight from new road with surfacespotlevelLabel and interpolate more hight where I need.
I can do this with a blockattribute but not a label. So I believe it must be a methode to can ask a label which value it haves in surfacehight.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #13 on: November 16, 2012, 06:55:18 AM »
No suggestions or not clear ?

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: CivilLabels converting ?
« Reply #14 on: November 16, 2012, 09:27:34 AM »
No suggestions or not clear ?
More like you responded whilst I was sleeping (11:10 p.m my time). I am just now checking for new replies (6:30 a.m. my time).

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: CivilLabels converting ?
« Reply #15 on: November 16, 2012, 09:44:20 AM »
Mainproblem is how can I rotate fast labels so they display correctly direction in planview.
While not quite as quick as the rotation of attributes, but definitely quicker than individually rotating labels, rotate one in the normal fashion with the grips. Go to the properties palette, copy the rotation value, now select the other points to rotate, paste the rotation value in the properties palette. Or, this could be automated with lisp or .NET.

Second thing is if I want interpolate between labels I need a value to can calculate new interpolated value. The point is sometimes I work faster if I generate mainhight from new road with surfacespotlevelLabel and interpolate more hight where I need.
I can do this with a blockattribute but not a label. So I believe it must be a methode to can ask a label which value it haves in surfacehight.
I'm not quite following you on this one. Although I think you could use points and the set point(s) by interpolate command. Also, instead of getting the label text, you CAN get the surface elevation at a location. I'll see if I can throw some code together to demonstrate this. Although, if the labels use any expressions, this method would not work very well.


mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: CivilLabels converting ?
« Reply #16 on: November 16, 2012, 09:55:51 AM »
all of this can be done with normal C3D labels and or using a different method

I teach an 'interpolation from corridor surfaces in most of my classes

Be your Best


Michael Farrell
http://primeservicesglobal.com/

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #17 on: November 23, 2012, 02:06:44 AM »
Is there any way to ask from a vla-object, if I inspect with vlide a SurfacLevelLabel what value it haves for surface "12.53" ?

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: CivilLabels converting ?
« Reply #18 on: November 23, 2012, 09:57:51 AM »
No, not directly. You can use normal lisp selection and (osnap) to get the insertion point information:

Command: (setq selection (entsel))
Select object: (<Entity name: 7ffff642150> (-470.441 -117.361 0.0))
Command: (setq pt (osnap (last selection) "_ins"))
(-471.302 -117.276 12.5304)

You may be able to select the object without user interaction by getting the bounding box, although I'm not sure how reliable that would be.

Starting with C3D2012, the .NET API has a Property for label objects called AnchorInfo from which you can get the Location (Insertion point) of the label. However, this is not exposed to the COM API which can be used by lisp. So you need to use either unreliable trickery in lisp, or move to .NET.

cadplayer

  • Bull Frog
  • Posts: 390
  • Autocad Civil3d, OpenDCL.Runtime, LISP, .NET (C#)
Re: CivilLabels converting ?
« Reply #19 on: November 23, 2012, 01:33:47 PM »
Thanks Jeff, that I was thinking too. I need little time :laugh: to learn program in the NET.API.
It´s a lot stuff for beginner but it´s really fun to use C#. Is it not so popular to program with API, there is pretty much documentaded :|

mac0312

  • Mosquito
  • Posts: 13
Re: CivilLabels converting ?
« Reply #20 on: November 30, 2012, 12:26:35 AM »
I´m no expert with Visual so I wondering how I can get entitydata from VLA-object ?

This may help in that respect:
http://lee-mac.com/entitylist.html

I can not connect to this website, I do not know why? Thanks!

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: CivilLabels converting ?
« Reply #21 on: November 30, 2012, 07:43:43 AM »
I´m no expert with Visual so I wondering how I can get entitydata from VLA-object ?

This may help in that respect:
http://lee-mac.com/entitylist.html

I can not connect to this website, I do not know why? Thanks!

As far as I know, my site is up and running.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: CivilLabels converting ?
« Reply #22 on: November 30, 2012, 08:22:19 AM »
Worked for me this morning.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.