Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vlax-invoke-method enumeration question (Custom Part Properties)

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
tyronebk
574 Views, 2 Replies

vlax-invoke-method enumeration question (Custom Part Properties)

How do I invoke a vlax method in lisp that requires enumerations? Here's my code. It is a port of some VBA code (which works fine), to add custom properties to pipe network parts.

 

(defun c:PipesExtraProp( / vrs appstr acad aeccApp aeccDoc oSettings oPipeNetworkCatDef param )
(vl-load-com)
(setq vrs (vlax-product-key))
(cond
	((vl-string-search "R18.1" vrs) (setq appstr "8.0")) ;2011
	((vl-string-search "R18.2" vrs) (setq appstr "9.0")) ;2012
	((vl-string-search "R19.0" vrs) (setq appstr "10.0")) ;2013
	((vl-string-search "R19.1" vrs) (setq appstr "10.3")) ;2014
	(t (alert "This command does not support this version of Civil 3D."))
)
(if
(and appstr
	(or acad (setq acad (vlax-get-acad-object) ) )
	(or aeccApp (setq aeccApp (vla-getinterfaceobject acad (strcat "AeccXUiPipe.AeccPipeApplication." appstr) ) ) )
	(or aeccDoc (setq aeccDoc (vlax-get aeccApp 'ActiveDocument) ) )
	)
		(progn
			(setq oSettings (vlax-get aeccDoc 'Settings) )
			(setq oPipeNetworkCatDef (vlax-get oSettings 'PipeNetworkCatDef) )
			(setq param (vlax-invoke-method oPipeNetworkCatDef 'DeclareNewParameter "TimeOfConcentration" "TimeOfConcentration" "TIME" "TimeOfConcentration" <<aeccDouble>> <<aeccDoubleGeneral>> "" :vlax-true :vlax-false) )
			(setq param (vlax-invoke-method oPipeNetworkCatDef 'DeclarePartProperty "TimeOfConcentration" <<aeccDomPipe>> 8.0) )
		)
	)
	(princ)
)

I can't figure out how to add the enumerations:

   aeccDouble (type AeccPartDataFieldType),

   aeccDoubleGeneral (type AeccPipeNetworkUsage),

   aeccDomPipe (type AeccPipeNetworkDomain).

 

Porting the code to .net would obviously be acceptable, but I have been unsuccessful there too. Thanks for any insights.

2 REPLIES 2
Message 2 of 3
Jeff_M
in reply to: tyronebk

I use Ilspy to read the dll's for the Interops and examine the Types there. It looks like all of these you are interested in are 0 based, increment by 1. Then I use the applicable integer in my lisp.

 

     public enum AeccPartDataFieldType
    {
        aeccUndefinedDataType,
        aeccDouble,
        aeccInt,
        aeccBool,
        aeccString
    }

 

     public enum AeccPipeNetworkDomain
    {
        aeccUndefinedDomain,
        aeccDomPipe,
        aeccDomStructure,
        aeccDomWire
    }

 

     public enum AeccPipeNetworkUsage
    {
        aeccUndefinedUsage,
        aeccDoubleGeneral,
        aeccDoubleNonZero,
        aeccDoubleNonZeroNonNeg,
        aeccDoubleDistance,
        aeccDoubleDistanceMinor,
        aeccDoubleAngle,
        aeccDoublePercent,
        aeccDoubleArea,
        aeccDoubleVolume,
        aeccDoubleElevation,
        aeccIntGeneral,
        aeccIntNonZero,
        aeccIntNonZeroNonNeg,
        aeccStringGeneral,
        aeccStringName,
        aeccStringGuid,
        aeccStringEnumKey,
        aeccBoolGeneral,
        aeccMultivalPosition,
        aeccMultivalDirection
    }

 

You could also use the (vlax-import-type-library) function, then you can refer to them by name. I used to use this but fell out of the habit quite a while ago.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3
tyronebk
in reply to: Jeff_M

Simple as that. I had tried integers earlier but couldn't get them to work, so there must have been something else wrong with my code at that time. Works perfect now. Thanks a lot Jeff.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report