Dynamic Block with associative hatch

Dynamic Block with associative hatch

SRSDS
Advisor Advisor
2,023 Views
6 Replies
Message 1 of 7

Dynamic Block with associative hatch

SRSDS
Advisor
Advisor

I have a problem getting the associative hatch of a dynamic block to update programatically.

They update when manually adjusting a grip stretch or modifying block dimensions using the properties palette so it's not a problem with the block.

It's a block with parameter constraints. Not sure if that's part of the problem.

I've attached an example of the type of block I have a problem with. 

Is there code that might help kick hatches into position?

 

 

 

0 Likes
Accepted solutions (1)
2,024 Views
6 Replies
Replies (6)
Message 2 of 7

SRSDS
Advisor
Advisor

Something very odd here. 

Norman Yuan posted code to test a dynamic block with an associated hatch.  

https://forums.autodesk.com/t5/net/insert-dynamic-block-with-hatch/m-p/9923684

Thank you Norman. Wondered if it had something to do with locking a document.

I tested it on my home PC.

The block behaved using that code but there was still something wrong with my code.

Went to work. My code was now working which left me really confused.

Wondered if AutoDesk had pushed an update to fix the problem.

 

I'm now back home on my home PC and seeing the original problem.

I remotely hooked into my work PC to double check and my work PC is behaving differently to my home PC.  

 

Same:

  • AutoCAD version
  • Visual Studio version
  • Visual Studio project (Dropbox)

Something is amiss. 

 

 

 

0 Likes
Message 3 of 7

SRSDS
Advisor
Advisor

Could it be a system variable setting?

0 Likes
Message 4 of 7

SRSDS
Advisor
Advisor
Accepted solution

Two computers at my work behave as expected, four don't. I copied the system variables between computers. Same graphics cards on computers that do and don't work. Still at a complete loss at how that could be. Makes no sense.

 

What I have found is that the hatches do update if a CommandMethod is used. I was using a timer in a pallete. 

0 Likes
Message 5 of 7

alexisgacia
Advocate
Advocate

Did you manage to fix your problem? How did you do it in timer?

0 Likes
Message 6 of 7

SRSDS
Advisor
Advisor

I think so. By using SendStringToExecute a CommandMethod.

The timer is irrelevent. I use a timer to limit the number of times this is code is triggered when typing into a text box.

0 Likes
Message 7 of 7

agabouryVN5EB
Explorer
Explorer

Hi so I think I found the issue it relates to the AutoCAD not being able to update the hatch graphics in time, when changes are made to the dynamic block programmatically. Every time you make a change to the dynamic block may it be transforming it, or changing a DynamicBlockReferenceProperty variable, run this snippet of code "acCurDb.TransactionManager.QueueForGraphicsFlush();" this will update the block graphics and it ensure that it displays correctly. 

0 Likes