AnsweredAssumed Answered

Insert block with automated increasing counter

Question asked by Alexander Leisentritt on Mar 31, 2010
Latest reply on Apr 6, 2010 by Alexander Leisentritt

Hi,

 

I am trying to make a function for my addin for SWX that is able to add a block to a drawing document that has a number in it and each copy I add will increase that number.

I tried two different ways so far. Both depend on a block I created with an attribut.

 

Way 1: I used a function I found here to start a drag drop action with the file from a self created form. That is like the normal function as if I would drag the file from explorer onto the drawing document. In this way I have problems getting the block object after the action to manipulate the counter.

 

Way 2: I tried to use the SketchBlockDefinition and SketchBlockInstance object to generate the block where the user click in the drawing. In this way I have the problem translating the mouse coordinates to the coordinates of the view. Well I got it working so far that the block is created near where i clicked with all that transform stuff I found here too. But when I create the SketchBlockDefinition object with MakeSketchBlockFromFile function the returned object is "nothing" and I can't create an instance and can't edit the attribute.

 

Second way I favourise because thats easier for the user than straing a drag and drop and this way I can implent some other thing linke changing the angle of the block and stuff.

 

Anyone a hint for me or had someone a similar function created and is willing to share some know how?

 

Regards

 

Alex

Outcomes