Jump to content

Recommended Posts

Posted

Hi everybody,

 

I am trying to access the tin surface build settings and more specifically the definition build options "Use maximum angle" and "Use maximum triangle length". When I list the surfaces as a vla-object I cannot see that properties available, meaning that vlax-put-property will not work .

Is there any other place or way to reach it and change it to Yes or No/ True or False?

So far I was trying with lisp, but I am open for any other solutions.

 

We are using some additional custom made programs for joining surfaces, which need that option to be disabled.

Posted

This is a good question!

 

I found where the "Use Maximum Triangle Length" is but didn't have too much luck on the "Use Maximum Angle". In order to find these you have to dig rather deep into the application. I used the following code to get to the "Use Maximum Triangle Length". I am using Civil 3D 2014.

 

I hope that this at least gets you looking in the right direction.

 

regards,

 

hippe013

 

 

 

Let surf-obj be your AeccDbSurfaceTin

 

From there we can get the Civil 3D Application using:

 

(setq app (vlax-get-property surf-obj 'Application))

 

Next we need to get the Active Document:

 

(setq ad (vlax-get-property app 'ActiveDocument))

 

From there we get the settings:

 

(setq settings (vlax-get-property ad 'Settings))

 

Then the Surface Command Settings:

 

(setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))

 

Then the Create Surface Settings:

 

(setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))

 

Then we finally reach the Build Options Settings:

 

(setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))

 

In that we find the Use Maximum Triangle Length which is a Property Boolean:

 

(setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))

 

We can set the vlaue of this to true or false using :vlax-true or :vlax-false

 

(vlax-put-property UseMaxTriLen 'value :vlax-true)

Posted

Tanks a lot for the replay,

 

I didnt know that this setting is so deeply hidden.

Only thing I am wondering now is how to make my expression aplicable for the seleced suface if there are so many levels.

Posted

I am not quite sure what it is you are asking. I would have to see your code in order to know where in your code you need to insert the above code.

 

Though the more I think about it. The boolean property probably needs to be set prior to the building of the surface.

 

If this is the case you need another way to access the application interface since the surface wouldn't exist at that time.

 

The following code is used to access the Application Interface in Civil 3D 2013

(setq *acad* (vlax-get-acad-object))
(setq app (vlax-invoke-method *acad* 'GetInterfaceobject "AeccXUiLand.AeccApplication.10.0"))

 

If using Civil 3D 2014 use "AeccXUiLand.AeccApplication.10.3"

and if using Civil 3D 2015 use "AeccXUiLand.AeccApplication.10.4"

 

I hope that this doesn't add confusion. Let me know what you come up with.

 

regards,

 

Hippe013

Posted

When I was looking at your findings form the firs post I actually realized that this was not what I was looking for.

 

I need to adjust the build settings of an already existing surface.

 

The setting you found is indeed the one for a new surface creation only.

Posted

Hi marko_ribar,

 

Unfortunately non of the settings is listed after (dumpallproperties (car (entsel))) - I am selecting random surface.

Posted
When I was looking at your findings form the firs post I actually realized that this was not what I was looking for.

 

I need to adjust the build settings of an already existing surface.

 

The setting you found is indeed the one for a new surface creation only.

 

I don't believe that this boolean is specific to each surface created. I believe that this boolean controls not only how surfaces are built but also how they are rebuilt. I would have to test it out to be certain. I don't believe that there is a boolean of this sort that is specific to how each individual surface is built.

 

Does this make sense?

 

regards,

 

hippe013

Posted

Hi Hippe013,

 

I was thinking the same as you, but that UseMaxTriLen doesn't change even if I chage the build settings manualy from the menu and rebuild the surface. That bloody value stays the same.

Posted

HMMMMMM??? :unsure:

 

May need dig a bit more in to this.

Posted

4o4osan,

 

I believe that I may have figured it out. I was thinking about how we were setting the value of 'UseMaxTriangleLen' Property to true, but our 'TrianglLenMax' was still set to zero. With these parameters no surface would ever be created with a max triangle length of zero. So figured I needed to set the Max Triangle Length to a value greater than zero and then set the 'UseMaxTriangleLen' to true.

 

I used the following code and was able to set the values.

 

;first we need to get the Civil 3D Application Interface
(setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.3"))

;Next we need to get the Active Document:
(setq ad (vlax-get-property app 'ActiveDocument))

;From there we get the settings:
(setq settings (vlax-get-property ad 'Settings))

;Then the Surface Command Settings:
(setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))

;Then the Create Surface Settings:
(setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))

;Then we finally reach the Build Options Settings:
(setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))

;Next We need to set our maximum triangle length
;Get the TrianglLenMax property
(setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))

;Set the value to something other than zero.
(setq tml (getreal "\nEnter Maximum Triangle Length: "))
(vlax-put-property trimaxlen 'Value tml)

;Then we need to get the UseMaxTriangleLen Property
(setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))

;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
(vlax-put-property UseMaxTriLen 'value :vlax-true)

 

The above code is tested on Civil 3D 2014. You may need to edit the code for Civil 3D 2013. To do this change the value 10.3 to 10.0 when retrieving the application interface.

 

Let me know if this works for you.

 

regards,

 

hippe013

  • 2 months later...
Posted

Hi Hippie13,

 

I believe that you can change the properties on the way you described, but how the code is it going to look with a combination of manual selection of an existing surface on which you want to change(disable) the build settings?

 

I tried many things but without any result yet.

Posted

Could you post what you have put together so far?

Posted

Hi Hippie,

 

I tested your code and it works fine, but Only on any new created surfaces - I can enable/disable the "Use maximum triangle length". My goal is to change the build settings of on an already existing surface.

 

[code](vl-load-com)

;first we need to get the Civil 3D Application Interface
;;;(setq app (vlax-get-or-create-object "AeccXUiLand.AeccApplication.10.0"))

(setq se (entsel "\nSelect Surface only: "))
(setq see (vlax-ename->vla-object  (car se)))
(setq app (vlax-get-property see 'Application))

;Next we need to get the Active Document:
(setq ad (vlax-get-property app 'ActiveDocument))

;From there we get the settings:
(setq settings (vlax-get-property ad 'Settings))

;Then the Surface Command Settings:
(setq surfcomset (vlax-get-property settings 'SurfaceCommandsSettings))

;Then the Create Surface Settings:
(setq createsurfset (vlax-get-property surfcomset 'CreateSurfaceSettings))

;Then we finally reach the Build Options Settings:
(setq buildoptionset (vlax-get-property createsurfset 'BuildOptionsSettings))

;Next We need to set our maximum triangle length
;Get the TrianglLenMax property
(setq trimaxlen (vlax-get-property buildoptionset 'TrianglLenMax))

;Set the value to something other than zero.
(setq tml (getreal "\nEnter Maximum Triangle Length: "))
(vlax-put-property trimaxlen 'Value tml)

;Then we need to get the UseMaxTriangleLen Property
(setq UseMaxTriLen (vlax-get-property buildoptionset 'UseMaxTriangleLen))

;We can set the vlaue of this to true or false using :vlax-true or :vlax-false
(vlax-put-property UseMaxTriLen 'value :vlax-true)

[/code]

 

That is my guess with adding some extra lines at the beginning of your code. It doesn't work and I know why - because I am changing variables which doesn't have any connection to the selected surface any more.

I am missing the knowledge of how to vlax-put-property on sub properties.

Posted

Need a tree diagram at times to work out how deep you are.

 

For any one interested this is my version check gets called as a defun before main program then release does not matter, saved in my autoload.lsp

 

;vercheck.lsp  version check for *aecc objects

(defun ah:vercheck ( / vrsn appstr)
(vl-load-com)
(if ((lambda (vrsn)
       (cond
        ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
        ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
        ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
        ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ?
        ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 
        ((vl-string-search "R19.1" vrsn)(setq appstr "11.0"));;2014
        ((vl-string-search "R20.0" vrsn)(setq appstr "12.0"));;2015
        ((alert "This version of C3D not supported!"))
       )
      )
      (vlax-product-key)
     )                         ; end if condition progn is true
     (progn
       (cond (*AeccDoc*)
         ((setq *AeccDoc*
           (vlax-get
             (cond (*AeccApp*)
               ((setq *AeccApp*
                 (vla-getinterfaceobject
                    (cond (*Acad*)
                    ((setq *Acad* (vlax-get-acad-object)))
                    )
                    (strcat "AeccXUiLand.AeccApplication." appstr)
                 )
                )
               )
             )
             'ActiveDocument
           )
          )
         )
       ) ; end main cond
     ) ; end progn
) ; end if vsrn
)

Posted

This may point you in the right direction.

 

Changes build settings of the existing surface. (Tested Civil 3d 2014)

 

;Get your existing surface
(setq surf-obj (vlax-ename->vla-object (car (entsel "\nSelect Surface Object:"))))

;Get the Surface Definition Properties
(setq defprop (vlax-get-property surf-obj 'DefinitionProperties))

;Set the Maximum Triangle Length
(setq tml (getreal "\nEnter Maximum Triangle Length:"))

(vlax-put-property defprop 'MaximumTriangleLength tml)

;Use Maximum Triangle Length
(vlax-put-property defprop 'UseMaximumTriangleLength :vlax-true)

;Rebuild your Surface
(vlax-invoke-method surf-obj 'Rebuild)

Posted

Hurray,

 

50% of the mission is completed. Many thanks Hippie13.

Your code works great for any surface.:D

 

I searched a bit more where I can change the UseMaximumAngle to No, buuut...again no luck.

 

The strange thing is that all of the definition options are listed in 'DefinitionProperties, except the one I am looking for:x

 

I read a bit more about that setting and it seems like the sub setting "Maximum angle between adjacent TIN lines" goes to the default value every time you save and open again the drawing. I tested and it is true, which makes it even more suspicious.

Anyway, I will keep digging!

Posted

Happy to hear that it's working for you!

 

I would suspect that the 'Use Maximum Angle between TIN Lines' has very little importance to most users therefore it's not included in the API. I can see reasons for using it (maybe?), but in all of the surfaces I put together I never find myself using that restraint setting.

 

As you may know there is very little documentation (if any at all) for the ActiveX methods & properties on Civil 3D objects.

 

I'd be willing to bet that the setting could be changed using .NET as it's the managed API.

 

regards,

 

hippe013

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...