Start a new topic

Newbie add comment to node question

 Hi all,

I don't have very much programming experience but I,m trying to adjust some models that I created with the "Sign Wizard" plug-in.
With the help of the samples codes that came with API installer, I've created a code that attaches an object (o1) to an lod (lod1). The lod itself is also generated by the Python code.
The code also changes the default values  to an desired integer.
But the comment field also need some changes but I cant find out how to do this.
In another topic on this board it seems that it should be very simple if you know any coding :)

This is what I've came up to so far and any help would be highly appreciated.
Stan

db = mgGetCurrentDb()

mgDeselectAll (db)

g1 = mgGetRecByName (db, "g1")
mgSetModelingParent (db, g1)

#mgExecute ("Create LOD", None)


lod1 = mgGetRecByName (db, "l1")
mgSetModelingParent (db, lod1)


rec = mgGetRecByName (db, "o1")

mgDetach (rec)
mgAttach (lod1, rec)

mgSelectOne(lod1)



paramBlock = mgGetParamBlock ("Modify Attributes")
mgParamSet (paramBlock, "Nested Record Code", 0)    # field is nested
mgParamSet (paramBlock, "Attribute Code", fltLodSwitchIn)
mgParamSet (paramBlock, "Double Value", 601230.00)
mgExecute ("Modify Attributes", paramBlock)

paramBlock = mgGetParamBlock ("Modify Attributes")
mgParamSet (paramBlock, "Nested Record Code", 0)    # field is nested
mgParamSet (paramBlock, "Attribute Code", fltLodTransition)
mgParamSet (paramBlock, "Double Value", 60.00)
mgExecute ("Modify Attributes", paramBlock)

paramBlock = mgGetParamBlock ("Modify Attributes")
mgParamSet (paramBlock, "Nested Record Code", 0)    # field is nested
mgParamSet (paramBlock, "Attribute Code", fltComment)
mgParamSet (paramBlock, "Char", "Scale by X")
mgExecute ("Modify Attributes", paramBlock)


Hi Chris,


Thanks for your help, your solution works fine!

In the meanwhile I also found a solution, but your is much shorter.


mgParamSet (paramBlock, "Attribute Code", fltComment)
mgParamSet (paramBlock,"String Value",'This is a comment' )


Thanks again,

Stanley

 

Hi, to set a comment on a node, you can use the mgSetComment()  function. It takes the node record that will get the comment and a string for a comment to set.


mgSetComment (myLodNode, 'This is the comment on my lod node')



1 person likes this
Login to post a comment